Skip to content

Commit

Permalink
Replace custom Button styles by using HStack component
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Aug 9, 2022
1 parent 1d30a2a commit 7c23528
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
41 changes: 19 additions & 22 deletions packages/components/src/custom-gradient-bar/control-points.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { LEFT, RIGHT } from '@wordpress/keycodes';
* Internal dependencies
*/
import Button from '../button';
import { HStack } from '../h-stack';
import { ColorPicker } from '../color-picker';
import { VisuallyHidden } from '../visually-hidden';
import { CustomColorPickerDropdown } from '../color-palette';
Expand Down Expand Up @@ -74,17 +75,9 @@ function ControlPointButton( { isOpen, position, color, ...additionalProps } ) {
}

function GradientColorPickerDropdown( { isRenderedInSidebar, ...props } ) {
const popoverProps = useMemo(
() => ( {
className:
'components-custom-gradient-picker__color-picker-popover',
} ),
[]
);
return (
<CustomColorPickerDropdown
isRenderedInSidebar={ isRenderedInSidebar }
popoverProps={ popoverProps }
{ ...props }
/>
);
Expand Down Expand Up @@ -246,21 +239,25 @@ function ControlPoints( {
} }
/>
{ ! disableRemove && controlPoints.length > 2 && (
<Button
className="components-custom-gradient-picker__remove-control-point"
onClick={ () => {
onChange(
removeControlPoint(
controlPoints,
index
)
);
onClose();
} }
variant="link"
<HStack
className="components-custom-gradient-picker__remove-control-point-wrapper"
alignment="center"
>
{ __( 'Remove Control Point' ) }
</Button>
<Button
onClick={ () => {
onChange(
removeControlPoint(
controlPoints,
index
)
);
onClose();
} }
variant="link"
>
{ __( 'Remove Control Point' ) }
</Button>
</HStack>
) }
</>
) }
Expand Down
7 changes: 2 additions & 5 deletions packages/components/src/custom-gradient-picker/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ $components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 1
}
}

.components-custom-gradient-picker__color-picker-popover .components-custom-gradient-picker__remove-control-point {
margin-left: auto;
margin-right: auto;
display: block;
margin-bottom: $grid-unit-10;
.components-custom-gradient-picker__remove-control-point-wrapper {
padding-bottom: $grid-unit-10;
}

.components-custom-gradient-picker__inserter {
Expand Down

0 comments on commit 7c23528

Please sign in to comment.