-
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
FormFileUpload: Add lint rule for 40px size prop usage #64585
Changes from all commits
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 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -491,17 +491,22 @@ export function MediaPlaceholder( { | |||||||||||||||
<> | ||||||||||||||||
{ renderDropZone() } | ||||||||||||||||
<FormFileUpload | ||||||||||||||||
variant="primary" | ||||||||||||||||
className={ clsx( | ||||||||||||||||
'block-editor-media-placeholder__button', | ||||||||||||||||
'block-editor-media-placeholder__upload-button' | ||||||||||||||||
render={ ( { openFileDialog } ) => ( | ||||||||||||||||
<Button | ||||||||||||||||
onClick={ openFileDialog } | ||||||||||||||||
variant="primary" | ||||||||||||||||
className={ clsx( | ||||||||||||||||
'block-editor-media-placeholder__button', | ||||||||||||||||
'block-editor-media-placeholder__upload-button' | ||||||||||||||||
) } | ||||||||||||||||
> | ||||||||||||||||
{ __( 'Upload' ) } | ||||||||||||||||
</Button> | ||||||||||||||||
Comment on lines
+494
to
+504
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. I moved this to an explicit render prop, so the upsizing can be resolved along with the other Button components surrounding it. The resulting output should remain the same. This is the gutenberg/packages/components/src/form-file-upload/index.tsx Lines 43 to 49 in 68dd5ce
An instance of MediaPlaceholder, with other buttons: |
||||||||||||||||
) } | ||||||||||||||||
onChange={ onUpload } | ||||||||||||||||
accept={ accept } | ||||||||||||||||
multiple={ !! multiple } | ||||||||||||||||
> | ||||||||||||||||
{ __( 'Upload' ) } | ||||||||||||||||
</FormFileUpload> | ||||||||||||||||
/> | ||||||||||||||||
{ uploadMediaLibraryButton } | ||||||||||||||||
{ renderUrlSelectionUI() } | ||||||||||||||||
{ renderFeaturedImageToggle() } | ||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,12 @@ import type Icon from '../icon'; | |
|
||
// TODO: Replace `children` and `icon` types with props from Button once Button is typed. | ||
export type FormFileUploadProps = { | ||
/** | ||
* Start opting into the larger default height that will become the default size in a future version. | ||
* | ||
* @default false | ||
*/ | ||
__next40pxDefaultSize?: boolean; | ||
Comment on lines
+13
to
+18
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. This was passed through as rest props to the underlying Button, but adding it here so it shows up explicitly in Storybook. |
||
/** | ||
* A string passed to `input` element that tells the browser which file types can be | ||
* upload to the upload by the user use. e.g: `image/*,video/*`. | ||
|
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.
Custom rule different from the others because FormFileUpload can take a
render
prop.