-
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
Borders: Add BorderBoxControl component #38876
Conversation
Size Change: +1.54 kB (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
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 is a very cool component! While there is a good amount of complexity being handled on the logic side, I was pleasantly surprised at how clean the UI implementation itself was. I don't know why but before reading the code I totally overcomplicated the visualizer implementation in my head — but it's actually just a positioned div! 🤦😆 Elegant use of grid
on top of it too!
packages/components/src/border-box-control/border-box-control-split-controls/component.tsx
Outdated
Show resolved
Hide resolved
packages/components/src/border-box-control/border-box-control-visualizer/component.tsx
Outdated
Show resolved
Hide resolved
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 others have also commented, this is great work!
I'm just leaving here some high-level feedback that I also gave on the sister PR #37769:
- using
ForwardedRef
type instead ofRef
- wrapping all styles that affect right/left in the
rtl()
utility function - trying to replace as many hardcoded DOM structures as possible with the Styled component selector (example)
- Investigate building the UI with the
Flex
andGrid
components when possible over CSS styles (this is more of a preference / exploration, definitely not blocking — I think it's interesting to explore the composability of our components and discover any potential limitations!) - avoid using inline styles where possible
Thank you again for your work on this one!
packages/components/src/border-box-control/border-box-control-visualizer/component.tsx
Outdated
Show resolved
Hide resolved
3dda204
to
b17da1a
Compare
08acd46
to
310cb96
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.
Awesome work on this complex component! 🚀
310cb96
to
31f7bc8
Compare
This provides a component through which you can configure separate borders for individual sides.
- Moves the `getClampedWidthBorderStyle` functionality into the style.ts file - Updates `getShorthandBorderStyle` to accept optional fallback border styles to work around possible override of inherited values.
31f7bc8
to
1aeb812
Compare
Related:
Description
This PR adds a
BorderBoxControl
component that provides a better experience when configuring individual borders for different sides.BorderBoxControl
BorderControl
to allow the configuration of a single flat border or individual borders for each side.How has this been tested?
Via unit tests;
npm run test-unit packages/components/src/border-box-control/test/index.js
npm run test-unit packages/components/src/border-box-control/test/utils.js
Manually:
npm run storybook:dev
BorderBoxControl
Screenshots
Types of changes
New feature.
Known Issues
Checklist:
*.native.js
files for terms that need renaming or removal).