-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Focal point picker -use the input-number class and styles already available #13709
Focal point picker -use the input-number class and styles already available #13709
Conversation
@@ -211,7 +211,7 @@ export class FocalPointPicker extends Component { | |||
<div className="components-focal-point-picker_position-display-container"> | |||
<BaseControl label={ __( 'Horizontal Pos.' ) }> | |||
<input | |||
className="components-text-control__input" | |||
className="components-range-control__number" |
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.
We should never assume a class name of another component, as it will most certainly cause breakage in the future.
If it's meant to be a range control, it should be implemented as a <RangeControl>
component.
Otherwise, its styles must be defined locally, and the class name assigned following the coding guidelines:
https://github.com/WordPress/gutenberg/blob/master/docs/contributors/coding-guidelines.md#naming
Thanks @aduth! That makes perfect sense and is sort of what I was thinking when I began working on #11555 . I also figured I'm also used to a more functional CSS methodology to styling. |
Yes,
I'm not entirely sure I follow the question. On its own, the changes from #11555 don't strike me as alarming, but it all depends how this transpires once FontSizePicker is fixed to stop appropriating the |
Yeah, I was kinda thinking aloud there. To answer my own question, my thinking was a little off. I was trying to cut down on duplicate code by re-using class-names with a predictable set of styles attached. While the results would be good, it isn't really inline with the coding guidelines. So, in light of discovering components like Focal Point and Font Size, both re-inventing the number input and misusing other control classes, my "new thinking" tells me that we need a I'll put something together for that and see how it works out. |
@m-e-h I think that's a great approach; a generic |
Hi There! I've triaging PRs today and it seems this one is stale. I'm going to close now as it doesn't seem like the desired direction. Thanks for your efforts. |
Description
Replaces the
class
on the number input fromcomponents-text-control__input
tocomponents-range-control__number
.Also removes the styles for that input since
components-range-control__number
already has number input styles.This keeps styles consistent with similar controls like "Background Opacity" and the "Columns" number range.
Visually looks the same. Might be a pixel or two different but it is consistent now.
Checklist: