-
Notifications
You must be signed in to change notification settings - Fork 42
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
Adding props to Checkbox component #1371
Conversation
…put-props-to-components
Just remembered I need to update the entry in Docs - I'll do that very soon! |
…put-props-to-components
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.
Make sure you add a changeset and link the issue number that this PR is referencing in the PR description
Done |
.changeset/empty-rockets-try.md
Outdated
'@itwin/itwinui-react': major | ||
--- | ||
|
||
Added wrapperProps to allow for styling of CheckBox wrapper. |
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.
Update changeset with all changes you've made
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.
Done
as='span' | ||
className={ | ||
(cx('iui-checkbox-label'), | ||
labelClassName ? labelClassName : className) |
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.
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 wrote it like that so that the label
and wrapper
would share a className with the parent component by default, unless the user goes out of their way to specify custom classNames for label
and wrapper
. Should their classNames both be different by default?
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.
Why they need to share className?
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.
They don't have to, I just figured some users might want them to. If they shouldn't share classNames by default, then I'll change the code so they don't
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.
If user wants to add styles to certain part of component, they need to use props for that part of component.
Remove this check.
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.
Modified "Should isomorphically apply class on %s"
to only test input
, and also removed the final failing test.
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.
it is no longer isomorphic so it's not testing anything special and can be removed
imo you should have a single unit test that tests adding separate custom classes all three elements (className
, labelProps
, wrapperProps
)
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.
Done
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.
you're only testing two cases in there, missing a test for className
which gets applied on the input.
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.
Added
Co-authored-by: Mayank <[email protected]>
…put-props-to-components
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.
A few nitpicky comments about the unit tests, but other than that, things look good to me!
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.
Once the changeset description changes, it's ready to go! 🎉 Great work
Co-authored-by: Mayank <[email protected]>
done! |
Changes
Adding the option for customizable wrapper props to be added to the Checkbox component. Issue: #1368
Testing
React unit testing and visual testing undertaken.
Docs
Docs will be updated to outline wrapperProps utility.