Skip to content

Commit

Permalink
refactor button color component into element
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieCabrera committed Oct 11, 2022
1 parent 8bb778f commit d25cace
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 105 deletions.
102 changes: 0 additions & 102 deletions packages/edit-site/src/components/global-styles/screen-button-color.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,24 @@ function ScreenColorElement( { name, element } ) {
const colorsPerOrigin = useColorsPerOrigin( name );
const [ solids ] = useSetting( 'color.palette', name );
const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
const [ isBackgroundEnabled ] = useSetting( 'color.background', name );

const hasElementColor =
let hasElementColor =
supports.includes( 'color' ) &&
( solids.length > 0 || areCustomSolidsEnabled );

if ( supports.includes( 'buttonColor' ) ) {
hasElementColor =
supports.includes( 'buttonColor' ) &&
isBackgroundEnabled &&
( solids.length > 0 || areCustomSolidsEnabled );
}

const [ elementTextColor, setElementTextColor ] = useStyle(
'elements.' + element + '.color.text',
name
);

const [ userElementTextColor ] = useStyle(
'elements.' + element + '.color.text',
name,
Expand Down
3 changes: 1 addition & 2 deletions packages/edit-site/src/components/global-styles/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import ScreenColorElement from './screen-color-element';
import ScreenTextColor from './screen-text-color';
import ScreenLinkColor from './screen-link-color';
import ScreenHeadingColor from './screen-heading-color';
import ScreenButtonColor from './screen-button-color';
import ScreenLayout from './screen-layout';
import ScreenStyleVariations from './screen-style-variations';

Expand Down Expand Up @@ -118,7 +117,7 @@ function ContextScreens( { name } ) {
<GlobalStylesNavigationScreen
path={ parentMenu + '/colors/button' }
>
<ScreenButtonColor name={ name } />
<ScreenColorElement name={ name } element="button" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>
Expand Down

0 comments on commit d25cace

Please sign in to comment.