-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
CustomSelectControl: Use __unstableSize
prop in Typography panel
#36162
Changes from all commits
df32624
0e2c9a6
53a01b1
465c34d
91e06d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,12 @@ import CustomSelectControl from '../'; | |
export default { | ||
title: 'Components/CustomSelectControl', | ||
component: CustomSelectControl, | ||
argTypes: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Controls FTW ! |
||
__unstableSize: { | ||
options: [ 'default', 'large' ], | ||
control: { type: 'select' }, | ||
}, | ||
}, | ||
}; | ||
|
||
const defaultOptions = [ | ||
|
@@ -31,29 +37,31 @@ const defaultOptions = [ | |
style: { fontSize: '300%' }, | ||
}, | ||
]; | ||
export const _default = () => ( | ||
<CustomSelectControl label="Font size" options={ defaultOptions } /> | ||
); | ||
|
||
const longLabelOptions = [ | ||
{ | ||
key: 'reallylonglabel1', | ||
name: 'Really long labels are good for stress testing', | ||
}, | ||
{ | ||
key: 'reallylonglabel2', | ||
name: 'But they can take a long time to type.', | ||
}, | ||
{ | ||
key: 'reallylonglabel3', | ||
name: | ||
'That really is ok though because you should stress test your UIs.', | ||
}, | ||
]; | ||
export const Default = CustomSelectControl.bind( {} ); | ||
Default.args = { | ||
hideLabelFromVision: false, | ||
label: 'Font size', | ||
options: defaultOptions, | ||
}; | ||
|
||
export const longLabels = () => ( | ||
<CustomSelectControl | ||
label="Testing long labels" | ||
options={ longLabelOptions } | ||
/> | ||
); | ||
export const LongLabels = CustomSelectControl.bind( {} ); | ||
LongLabels.args = { | ||
...Default.args, | ||
label: 'Testing long labels', | ||
options: [ | ||
{ | ||
key: 'reallylonglabel1', | ||
name: 'Really long labels are good for stress testing', | ||
}, | ||
{ | ||
key: 'reallylonglabel2', | ||
name: 'But they can take a long time to type.', | ||
}, | ||
{ | ||
key: 'reallylonglabel3', | ||
name: | ||
'That really is ok though because you should stress test your UIs.', | ||
}, | ||
], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ import { | |
|
||
function FontSizePicker( | ||
{ | ||
__unstableSize, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this also have a default value of |
||
fallbackFontSize, | ||
fontSizes = [], | ||
disableCustomFontSizes = false, | ||
|
@@ -148,6 +149,7 @@ function FontSizePicker( | |
shouldUseSelectControl && | ||
! showCustomValueControl && ( | ||
<CustomSelectControl | ||
__unstableSize={ __unstableSize } | ||
className={ `${ baseClassName }__select` } | ||
label={ __( 'Font size' ) } | ||
hideLabelFromVision | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have a default value of
default
, as suggested by the options defined in the Storybook example?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, in order to align values used across components, should we also consider allowing a value of
small
for this prop?