Skip to content
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

TimeInput: Add label prop #63106

Merged
merged 2 commits into from
Jul 4, 2024
Merged

TimeInput: Add label prop #63106

merged 2 commits into from
Jul 4, 2024

Conversation

mirka
Copy link
Member

@mirka mirka commented Jul 3, 2024

Part of #52734
Follow-up to #60613

What?

Adds a label prop to TimeInput.

Why?

Since some people will be using this as an alternative to TimePicker, we need a way to add a visual label as well. (Technically, it needs to be a fieldset legend rather than a label.)

Testing Instructions

See Storybook for TimeInput to test behavior.

(Code changes are easier to review with whitespace hidden)

@mirka mirka added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Jul 3, 2024
@mirka mirka self-assigned this Jul 3, 2024
@mirka mirka requested a review from ajitbohra as a code owner July 3, 2024 20:37
@mirka mirka requested a review from a team July 3, 2024 20:38
Copy link

github-actions bot commented Jul 3, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with and without a label - works as expected, thanks! 🚀

@mirka mirka merged commit cae3225 into trunk Jul 4, 2024
63 checks passed
@mirka mirka deleted the time-input-label branch July 4, 2024 10:30
@github-actions github-actions bot added this to the Gutenberg 18.8 milestone Jul 4, 2024
/**
* The label for the time input.
*/
label?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider making the label required by default, so that when the input is used standalone consumers are nudged towards labelling it? We could disable the rule when compositing is in DateTimePicker.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a huge issue for this one specifically, because the hours and minutes inputs are both labeled.

In the general case though (re: #51740), I'm starting to think that an eslint rule for our repo might be a good way to nudge devs without compromising the "truthfulness" of our TS types.

carstingaxion pushed a commit to carstingaxion/gutenberg that referenced this pull request Jul 18, 2024
* TimeInput: Add `label` prop

* Add changelog

Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants