-
Notifications
You must be signed in to change notification settings - Fork 130
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
feat(components): add component context and Link component #490
Conversation
Codecov Report
@@ Coverage Diff @@
## canary #490 +/- ##
==========================================
+ Coverage 76.15% 76.19% +0.04%
==========================================
Files 167 171 +4
Lines 2453 2466 +13
Branches 435 436 +1
==========================================
+ Hits 1868 1879 +11
- Misses 467 468 +1
- Partials 118 119 +1
|
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.
Nice! 🌞
🎉 This PR is included in version 1.2.2-canary.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@connor-baer I think I'm missing the point (maybe long term vision) but why would the consumer use the Also I might be missing the long term vision here too, but do we really want to start providing components that translate directly to a primitive? EG: Just a plain Why would the consumer use this as |
You make a good point here. Using the component context/primitive components from Circuit UI might not make sense for the consumer since as you rightfully pointed out, they can simply import the component directly. I didn't think about that. However, that's only a secondary use case. The important feature here is that you can override the primitive components that Circuit UI itself uses under the hood. Maybe it was a mistake to expose the |
I'm not really sure. But at first glance looks like a really complex engine to solve a single use case we have (The SideNav). Very rarely we expect the primitives to be replaced when used with the molecules we provide. I think what would really help us here is also have a look at the component roadmap to figure out the complexity of coming updates for our components. For instance, this use case could've been initially solved by adding a The code is fine and well structured of course. I'm just concerned long term the Component context will just be used for the SideNav and nothing else, you know? |
It's already being used for the Button component as well. Previously on the partner portal, the Button component was wrapped in a Link component which produced invalid and inaccessible markup: <Link to={ROUTE.HOME}>
<Button>Home</Button>
</Link>
// produced:
<a href="/">
<button>Home</button>
</a> I was able to fix it with I can definitely see this being used for other components as well, e.g. a |
Ok. I think the best way to test this out is simply using it and see how it feels. Let's give it a try! |
Closes #466.
Purpose
Some of the low-level functional components in Circuit UI need to be customizable. This is useful e.g. when your application is using a custom router and needs to use a special
Link
component.Approach and changes
ComponentsContext
with awithComponents
HOC anduseComponents
hookLink
componentLink
component in theButton
andSidebar
componentsDefinition of done