Skip to content

Commit

Permalink
Move ColorIndicator styles to sass
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Apr 1, 2022
1 parent ba0e353 commit dcca723
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
11 changes: 2 additions & 9 deletions packages/edit-site/src/components/global-styles/palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,12 @@ function Palette( { name } ) {
colors.length === 0 ? 'row-reverse' : 'row'
}
>
<ZStack
isLayered={ false }
offset={ -8 }
// TODO:
// - move to SCSS code + classname
// - consider using grid scss variables
// - consider adding a size prop to `ColorIndicator` ?
style={ { marginTop: '2px', marginBottom: '2px' } }
>
<ZStack isLayered={ false } offset={ -8 }>
{ colors.slice( 0, 5 ).map( ( { color } ) => (
<ColorIndicator
key={ color }
colorValue={ color }
className="edit-site-global-styles__color-indicator-with-margin"
/>
) ) }
</ZStack>
Expand Down
18 changes: 3 additions & 15 deletions packages/edit-site/src/components/global-styles/screen-colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ function BackgroundColorItem( { name, parentMenu } ) {
<HStack justify="flex-start">
<ColorIndicator
colorValue={ gradientValue ?? backgroundColor }
// TODO:
// - move to SCSS code + classname
// - consider using grid scss variables
// - consider adding a size prop to `ColorIndicator` ?
style={ { marginTop: '2px', marginBottom: '2px' } }
className="edit-site-global-styles__color-indicator-with-margin"
/>
<FlexItem>{ __( 'Background' ) }</FlexItem>
</HStack>
Expand All @@ -62,11 +58,7 @@ function TextColorItem( { name, parentMenu } ) {
<HStack justify="flex-start">
<ColorIndicator
colorValue={ color }
// TODO:
// - move to SCSS code + classname
// - consider using grid scss variables
// - consider adding a size prop to `ColorIndicator` ?
style={ { marginTop: '2px', marginBottom: '2px' } }
className="edit-site-global-styles__color-indicator-with-margin"
/>
<FlexItem>{ __( 'Text' ) }</FlexItem>
</HStack>
Expand All @@ -88,11 +80,7 @@ function LinkColorItem( { name, parentMenu } ) {
<HStack justify="flex-start">
<ColorIndicator
colorValue={ color }
// TODO:
// - move to SCSS code + classname
// - consider using grid scss variables
// - consider adding a size prop to `ColorIndicator` ?
style={ { marginTop: '2px', marginBottom: '2px' } }
className="edit-site-global-styles__color-indicator-with-margin"
/>
<FlexItem>{ __( 'Links' ) }</FlexItem>
</HStack>
Expand Down
6 changes: 6 additions & 0 deletions packages/edit-site/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,9 @@
}
}

.edit-site-global-styles__color-indicator-with-margin {
// Add 4px to compensate for the fact that `ColorIndicator` has a height
// of 20px, while all other icons have a height of 24px.
margin-top: $grid-unit * 0.25;
margin-bottom: $grid-unit * 0.25;
}

0 comments on commit dcca723

Please sign in to comment.