Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Make sure classic themes have a Mini Cart contents width value set up
Browse files Browse the repository at this point in the history
  • Loading branch information
Aljullu committed May 4, 2023
1 parent bc1a202 commit 300fd35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions assets/js/base/components/drawer/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
:root {
/* This value might be overridden in PHP based on the attribute set by the user. */
--drawer-width: 480px;
--neg-drawer-width: calc(var(--drawer-width) * -1);
}

Expand Down
6 changes: 4 additions & 2 deletions src/BlockTypes/MiniCartContents.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ protected function enqueue_assets( array $attributes ) {
),
);

$drawer_width = array_key_exists( 'width', $attributes ) ? $attributes['width'] : '480px';
$parsed_style = ':root{--drawer-width: ' . esc_html( $drawer_width ) . '}';
$parsed_style = '';
if ( array_key_exists( 'width', $attributes ) ) {
$parsed_style .= ':root{--drawer-width: ' . esc_html( $attributes['width'] ) . '}';
}

foreach ( $styles as $style ) {
$selector = is_array( $style['selector'] ) ? implode( ',', $style['selector'] ) : $style['selector'];
Expand Down

0 comments on commit 300fd35

Please sign in to comment.