-
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
Add Label Support for URLInput Component #15669
Conversation
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.
Hi @pstonier, thank you for your contribution.
I used the following test component to verify differences between components with labels and components without label and to compare against the result in master:
const [ url, setUrl ] = useState( '' );
return (
<>
<URLInput
value={ url }
onChange={ setUrl }
/>
<URLInput
label="With label"
value={ url }
onChange={ setUrl }
/>
</>
);
Things worked as expected, and the only difference between the result in this branch and the result in the master is that in this branch the label appears.
I noticed that when this component is used in the inspector without additional styles changes, the dimensions are wrong, and the result is unexpected, but that is not a regression from these changes.
I agree with your suggestions and have submitted the changes. |
Thanks for catching that. The most recent commit should fix it. |
.components-base-control:last-child, | ||
.components-base-control:last-child .components-base-control__field { | ||
margin-bottom: 0; | ||
} |
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.
This might be necessary, but it didn't fix the styling problem for me. Adding the following rule, removed the extra space below the input:
.block-editor-url-input > .components-base-control__field {
margin-bottom: 0;
}
@talldan is this the margin that you were referring to?
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.
Hey @pablinos. Yep, that looks like it.
I pushed a couple of commits to finish this PR off, and tested as a replacement for the hackery in Automattic/jetpack#13745. @pstonier: Are you able to rebase this PR? GitHub was acting up on me when I tried to push a rebase, it should hopefully work for you. |
aae416a
to
e4aeb7e
Compare
Removes the defualt base control bottom margin when in a URLPopover.
This also removes its usage from the Button component.
adc50a8
to
dccfa7e
Compare
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.
I'm liking where this is at. Thank you for your persistence in getting this across the line, @pstonier!
Description
Added the ability to set a label for the URLInput field to follow the same structure as the TextControl.
How has this been tested?
Locally in Chrome.
Screenshots
Types of changes
Checklist: