Skip to content

Commit

Permalink
hide/show default shadows based on the setting from theme.json
Browse files Browse the repository at this point in the history
  • Loading branch information
madhusudhand committed Dec 30, 2022
1 parent 164d870 commit e25741c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
"text": true
},
"shadow": {
"defaultPalette": true,
"palette": [
{
"name": "Natural",
Expand Down
15 changes: 9 additions & 6 deletions packages/edit-site/src/components/global-styles/shadow-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,20 @@ function renderShadowToggle() {
function ShadowPopoverContainer( { shadow, onShadowChange } ) {
const [ defaultShadows ] = useSetting( 'shadow.palette.default' );
const [ themeShadows ] = useSetting( 'shadow.palette.theme' );
const [ defaultPaletteEnabled ] = useSetting( 'shadow.defaultPalette' );

return (
<div className="edit-site-global-styles__shadow-panel">
<VStack spacing={ 4 }>
<Heading level={ 5 }>{ __( 'Drop shadows' ) }</Heading>
<ShadowPresets
label={ __( 'Default' ) }
presets={ defaultShadows }
activeShadow={ shadow }
onSelect={ onShadowChange }
/>
{ defaultPaletteEnabled && (
<ShadowPresets
label={ __( 'Default' ) }
presets={ defaultShadows }
activeShadow={ shadow }
onSelect={ onShadowChange }
/>
) }
<ShadowPresets
label={ __( 'Theme' ) }
presets={ themeShadows }
Expand Down

1 comment on commit e25741c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3804784869
📝 Reported issues:

Please sign in to comment.