-
Notifications
You must be signed in to change notification settings - Fork 2.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
[core] Add space in between Label 'text' and 'helperText'. #2180
[core] Add space in between Label 'text' and 'helperText'. #2180
Conversation
Good morning. Having a bit if trouble getting Circle to run on my new branch. Is this something you do on your end? Excited to start helping out. |
Looks like your build workflow did run, but it was canceled. Can you try to retrigger it? https://circleci.com/gh/danielbh/workflows/blueprint/tree/dh%2Fadd-space-between-text-and-helperText |
Ok I re-triggered it. I had the "only build pull requests" option selected for some reason. I also needed to add a new commit. |
Update labelTests.tsxPreview: documentation | landing | table |
thanks! |
@@ -42,7 +42,7 @@ export class Label extends React.PureComponent<ILabelProps, {}> { | |||
return ( | |||
<label {...htmlProps} className={rootClasses}> | |||
{text} | |||
<span className={classNames(Classes.TEXT_MUTED)}>{helperText}</span> | |||
<span className={classNames(Classes.TEXT_MUTED)}>{helperText ? " " + helperText : ""}</span> |
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.
As the helper text is conditional, would it not be best to keep the span out of the DOM completely if helperText doesn't exist? e.g.
{helperText && <span className={classNames(Classes.TEXT_MUTED)}>{" " + helperText}</span>}
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.
Thanks for pointing this out Will. It seems cleaner to me. I’ll look if this affects the CSS. I can re-submit a PR tonight.
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.
Ah, the changes have broken the ability to add a React node as the helpertext e.g.
<Label
text="Username"
helperText={
<span style={{ display: 'block', fontSize: '80%' }}>
blah
</span>
}
>
...
</Label>
This now displays as : Username [object Object]
I suggest changing to:
{helperText && <span className={classNames(Classes.TEXT_MUTED)}>{" "}{helperText}</span>}
I'll log this as another issue
Fixes #2175
Checklist
Changes proposed in this pull request:
Adds a space in between
text
andhelperText
for the Label componentReviewers should focus on:
The updated
Label
component and new testsScreenshot
Before
After