Skip to content

Commit

Permalink
Components: FontSizePicker: Adjust Select Button sizing (#19479)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Quach committed Jan 29, 2020
1 parent c2eece7 commit 167bd70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions packages/components/src/custom-select-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const stateReducer = (
return {
selectedItem:
items[
selectedItem ?
Math.min( items.indexOf( selectedItem ) + 1, items.length - 1 ) :
0
selectedItem
? Math.min( items.indexOf( selectedItem ) + 1, items.length - 1 )
: 0
],
};
case useSelect.stateChangeTypes.ToggleButtonKeyDownArrowUp:
Expand All @@ -40,9 +40,9 @@ const stateReducer = (
return {
selectedItem:
items[
selectedItem ?
Math.max( items.indexOf( selectedItem ) - 1, 0 ) :
items.length - 1
selectedItem
? Math.max( items.indexOf( selectedItem ) - 1, 0 )
: items.length - 1
],
};
default:
Expand Down Expand Up @@ -73,6 +73,7 @@ export default function CustomSelectControl( {
selectedItem: _selectedItem,
stateReducer,
} );

const menuProps = getMenuProps( {
className: 'components-custom-select-control__menu',
} );
Expand Down Expand Up @@ -103,6 +104,7 @@ export default function CustomSelectControl( {
'aria-label': label,
'aria-labelledby': undefined,
className: 'components-custom-select-control__button',
isSmall: true,
} ) }
>
{ itemToString( selectedItem ) }
Expand Down
8 changes: 4 additions & 4 deletions storybook/test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2554,7 +2554,7 @@ exports[`Storyshots Components/CustomSelectControl Default 1`] = `
aria-expanded={false}
aria-haspopup="listbox"
aria-label="Font Size"
className="components-button components-custom-select-control__button"
className="components-button components-custom-select-control__button is-small"
id="downshift-null-toggle-button"
onClick={[Function]}
onKeyDown={[Function]}
Expand Down Expand Up @@ -3092,7 +3092,7 @@ exports[`Storyshots Components/FontSizePicker Default 1`] = `
aria-expanded={false}
aria-haspopup="listbox"
aria-label="Preset Size"
className="components-button components-custom-select-control__button"
className="components-button components-custom-select-control__button is-small"
id="downshift-null-toggle-button"
onClick={[Function]}
onKeyDown={[Function]}
Expand Down Expand Up @@ -3180,7 +3180,7 @@ exports[`Storyshots Components/FontSizePicker With Slider 1`] = `
aria-expanded={false}
aria-haspopup="listbox"
aria-label="Preset Size"
className="components-button components-custom-select-control__button"
className="components-button components-custom-select-control__button is-small"
id="downshift-null-toggle-button"
onClick={[Function]}
onKeyDown={[Function]}
Expand Down Expand Up @@ -3312,7 +3312,7 @@ exports[`Storyshots Components/FontSizePicker Without Custom Sizes 1`] = `
aria-expanded={false}
aria-haspopup="listbox"
aria-label="Preset Size"
className="components-button components-custom-select-control__button"
className="components-button components-custom-select-control__button is-small"
id="downshift-null-toggle-button"
onClick={[Function]}
onKeyDown={[Function]}
Expand Down

0 comments on commit 167bd70

Please sign in to comment.