Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components: FontSizePicker: Adjust Select Button sizing #19479

Merged
merged 3 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix unit tests and remove isSmall prop
  • Loading branch information
youknowriad committed Jan 29, 2020
commit 67f13d2bd4ad12f209912e29fdd4392753972a18
6 changes: 0 additions & 6 deletions packages/components/src/custom-select-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ Used to visually hide the label. It will always be visible to screen readers.
- Type: `Boolean`
- Required: No

#### isSmall

Renders the Select in a smaller size.
- Type: `Boolean`
- Required: No

#### label

The label for the control.
Expand Down
15 changes: 7 additions & 8 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 All @@ -55,7 +55,6 @@ export default function CustomSelectControl( {
label,
options: items,
onChange: onSelectedItemChange,
isSmall = true,
value: _selectedItem,
} ) {
const {
Expand Down Expand Up @@ -105,7 +104,7 @@ export default function CustomSelectControl( {
'aria-label': label,
'aria-labelledby': undefined,
className: 'components-custom-select-control__button',
isSmall,
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