From dbde85e9f1ba9412c32561e387d4a303fbcc8c2b Mon Sep 17 00:00:00 2001 From: himanshupathak95 Date: Wed, 5 Feb 2025 10:40:04 +0530 Subject: [PATCH] Font Size Picker: Remove Custom option from FontSizePickerSelect dropdown --- .../font-size-picker-select.tsx | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/packages/components/src/font-size-picker/font-size-picker-select.tsx b/packages/components/src/font-size-picker/font-size-picker-select.tsx index b33c382f3393e4..fcc80355ddd19a 100644 --- a/packages/components/src/font-size-picker/font-size-picker-select.tsx +++ b/packages/components/src/font-size-picker/font-size-picker-select.tsx @@ -20,21 +20,8 @@ const DEFAULT_OPTION: FontSizePickerSelectOption = { value: undefined, }; -const CUSTOM_OPTION: FontSizePickerSelectOption = { - key: 'custom', - name: __( 'Custom' ), -}; - const FontSizePickerSelect = ( props: FontSizePickerSelectProps ) => { - const { - __next40pxDefaultSize, - fontSizes, - value, - disableCustomFontSizes, - size, - onChange, - onSelectCustom, - } = props; + const { __next40pxDefaultSize, fontSizes, value, size, onChange } = props; const areAllSizesSameUnit = !! getCommonSizeUnit( fontSizes ); @@ -59,12 +46,10 @@ const FontSizePickerSelect = ( props: FontSizePickerSelectProps ) => { hint, }; } ), - ...( disableCustomFontSizes ? [] : [ CUSTOM_OPTION ] ), ]; - const selectedOption = value - ? options.find( ( option ) => option.value === value ) ?? CUSTOM_OPTION - : DEFAULT_OPTION; + const selectedOption = + options.find( ( option ) => option.value === value ) ?? DEFAULT_OPTION; return ( { }: { selectedItem: FontSizePickerSelectOption; } ) => { - if ( selectedItem === CUSTOM_OPTION ) { - onSelectCustom(); - } else { - onChange( selectedItem.value ); - } + onChange( selectedItem.value ); } } size={ size } />