-
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
Add Link component and component context #466
Comments
But how different is this from a regular |
Let's take the You could just render an Often, these Does that make it clearer? |
* feat(components): add ComponentsContext ISSUES CLOSED: #466 * feat(components): use Link from context in Sidebar * feat(components): use Link from context in Buttons * docs(components): write guidelines on how to override base components * docs(components): explain how to use the components in an app
🎉 This issue has been resolved in version 1.2.2-canary.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 1.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Visual
The Link component would be mostly functional and would have no specific visual styles itself.
Context
The Link component would be used wherever an
<a>
element would normally be used, such as in the Button or Navigation components. It would be particularly useful for more complex components on the molecule or organism stage in the Atomic Design methodology.In order for the Link component to remain application-agnostic, there needs to be a way to customize it. This is where the component context comes into play. It allows to override the Link component with a custom one, e.g. from
react-router
,reach-router
or Next.js.The Link component API should follow the APIs of common routing libraries.
Here's an example of how the pieces fit together:
The component context could be used for other components as well, e.g. a Head component. I'm successfully using this approach in my personal component library Bamboo UI.
State
Does this component have state? No.
Progressive enhancement
By default, the Link component renders an
<a>
element with anhref
attribute so a user is still able to navigate when JavaScript is disabled or crashes.The text was updated successfully, but these errors were encountered: