Typography Panel: Make letter spacing jsDoc and prop use consistent #36367
Typography Panel: Make letter spacing jsDoc and prop use consistent #36367aaronrobertshaw merged 2 commits intotrunkfrom
Conversation
|
Size Change: +6 B (0%) Total Size: 1.09 MB
ℹ️ View Unchanged
|
ciampo
left a comment
There was a problem hiding this comment.
Thank you so much for taking action on my feedback!
| * @param {Object} props Component props. | ||
| * @param {string} props.value Currently selected letter-spacing. | ||
| * @param {Function} props.onChange Handles change in letter-spacing selection. | ||
| * @param {string|number|null} props.__unstableInputWidth Input width to pass through to inner UnitControl. |
There was a problem hiding this comment.
While null is going to work at runtime (because of this check), it isn't really compatible with the type used in InputControl:
Ideally, we should change this to
| * @param {string|number|null} props.__unstableInputWidth Input width to pass through to inner UnitControl. | |
| * @param {import('react').CSSProperties['width'] | } props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS width value. |
but I'm not sure it's actually going to work (it may require the JSDoc comment to be wrapped in
/* eslint-disable jsdoc/valid-types */
[...]
/* eslint-enable jsdoc/valid-types */
A simpler version could be to:
| * @param {string|number|null} props.__unstableInputWidth Input width to pass through to inner UnitControl. | |
| * @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS width value. |
and maybe pass either '100%' or '' instead of null ?
There was a problem hiding this comment.
The simpler approach looks good to me. The jsdoc is clear, no exceptions to linting rules, and the switch to use 100% is explicit. Hard to misinterpret that 🙂
Thanks!
Let me know if you'd still prefer the jsdoc to import the CSS width property type.
ed6eaf8 to
85635f5
Compare
Description
This PR addresses concerns raised in #35911 (review) where the default
__unstableWidthvalue for the letter spacing control is overridden so that100%width can be restored when in the context of the TypographyToolsPanel.How has this been tested?
100%width60pxwidthScreenshots
Types of changes
Enhancement.
Checklist:
*.native.jsfiles for terms that need renaming or removal).