From 6a30654c92661e45091a2018ed5d028d0d012a68 Mon Sep 17 00:00:00 2001 From: Jon Q Date: Tue, 7 Jan 2020 10:49:55 -0500 Subject: [PATCH 1/3] Components: FontSizePicker: Adjust Select Button sizing This update enhances `CustomSelectControl` to accept props to modify it's internal `Button` component (`Object`). Since `FontSizePicker` uses `CustomSelectControl`, this update allows us to specify the `isSmall` property for the `Button`. By doing so, it fixes the alignment of the Select with the other form control elements. --- packages/components/src/custom-select-control/README.md | 6 ++++++ packages/components/src/custom-select-control/index.js | 5 ++++- packages/components/src/font-size-picker/index.js | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/components/src/custom-select-control/README.md b/packages/components/src/custom-select-control/README.md index 62dc6920b49a2..4c345b8152d62 100644 --- a/packages/components/src/custom-select-control/README.md +++ b/packages/components/src/custom-select-control/README.md @@ -102,6 +102,12 @@ Function called with the control's internal state changes. The `selectedItem` pr - Type: `Function` - Required: No +#### selectButtonProps + +Props to pass to the internally rendered `Button` component. +- Type: `Object` +- Required: No + #### value Can be used to externally control the value of the control, like in the `MyControlledCustomSelectControl` example above. diff --git a/packages/components/src/custom-select-control/index.js b/packages/components/src/custom-select-control/index.js index b6570ec4ae7b9..b00a1fff026cf 100644 --- a/packages/components/src/custom-select-control/index.js +++ b/packages/components/src/custom-select-control/index.js @@ -55,6 +55,7 @@ export default function CustomSelectControl( { label, options: items, onChange: onSelectedItemChange, + selectButtonProps = {}, value: _selectedItem, } ) { const { @@ -73,6 +74,7 @@ export default function CustomSelectControl( { selectedItem: _selectedItem, stateReducer, } ); + const menuProps = getMenuProps( { className: 'components-custom-select-control__menu', } ); @@ -99,10 +101,11 @@ export default function CustomSelectControl( {