-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Borders: Add BorderBoxControl component #38876
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
Conversation
|
Size Change: +1.54 kB (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
mirka
left a comment
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
Show resolved
Hide resolved
packages/components/src/border-box-control/border-box-control-visualizer/component.tsx
Outdated
Show resolved
Hide resolved
ciampo
left a comment
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
ForwardedReftype 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
FlexandGridcomponents 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
mirka
left a comment
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
BorderBoxControlcomponent that provides a better experience when configuring individual borders for different sides.BorderBoxControlBorderControlto 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.jsnpm run test-unit packages/components/src/border-box-control/test/utils.jsManually:
npm run storybook:devBorderBoxControlScreenshots
Types of changes
New feature.
Known Issues
Checklist:
*.native.jsfiles for terms that need renaming or removal).