From 426cdf25737d464087aebe49f2d3ccc040c1351e Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 5 Jan 2024 06:53:13 +0900 Subject: [PATCH 1/3] BorderControl: Replace style picker with ToggleGroupControl --- .../border-control-dropdown/component.tsx | 3 +- .../border-control-style-picker/component.tsx | 97 ++++++------------- .../border-control-style-picker/hook.ts | 35 ------- .../border-control/component.tsx | 2 + .../src/border-control/border-control/hook.ts | 27 +++--- .../components/src/border-control/styles.ts | 15 --- .../components/src/border-control/types.ts | 10 +- 7 files changed, 58 insertions(+), 131 deletions(-) delete mode 100644 packages/components/src/border-control/border-control-style-picker/hook.ts diff --git a/packages/components/src/border-control/border-control-dropdown/component.tsx b/packages/components/src/border-control/border-control-dropdown/component.tsx index 3ee01bcda8f3b..0a56edd946308 100644 --- a/packages/components/src/border-control/border-control-dropdown/component.tsx +++ b/packages/components/src/border-control/border-control-dropdown/component.tsx @@ -142,6 +142,7 @@ const BorderControlDropdown = ( enableStyle, indicatorClassName, indicatorWrapperClassName, + isStyleSettable, onReset, onColorChange, onStyleChange, @@ -218,7 +219,7 @@ const BorderControlDropdown = ( clearable={ false } enableAlpha={ enableAlpha } /> - { enableStyle && ( + { enableStyle && isStyleSettable && ( { - const { label, hideLabelFromVision } = props; - - if ( ! label ) { - return null; - } - - return hideLabelFromVision ? ( - { label } - ) : ( - { label } - ); -}; - -const BorderControlStylePicker = ( - props: WordPressComponentProps< StylePickerProps, 'div' >, +function UnconnectedBorderControlStylePicker( + { onChange, ...restProps }: StylePickerProps, forwardedRef: React.ForwardedRef< any > -) => { - const { - buttonClassName, - hideLabelFromVision, - label, - onChange, - value, - ...otherProps - } = useBorderControlStylePicker( props ); - +) { return ( - -