-
Notifications
You must be signed in to change notification settings - Fork 25
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
chore(@kadena/react-ui): Updated the Link component to work with external links #834
Conversation
🦋 Changeset detectedLatest commit: e8f7bb8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
I feel the best way to really review this and see if it suits our needs the way we hope, is through actually field testing it and implementing it. Should we update components that currently support Next Links so that they use this? I'm guessing that would be the idea anyway and then we can see if we run into other issues or not? |
There is been some confusion about how to use react-ui components with Next/Link. Previously many different solutions have shown up across the components, but this PR is the result of an effort to create one convention for this issue.
This approach allows users to set an
asChild
prop on the Link component and add the external component as a direct child. When this prop is set, all props from the Link component are passed down to the child along with styles and icons.It can be used like so:
The benefit of this is that the semantic html ends up with only one anchor and it keeps the styles and logic within the ui library's Link component
Caveats:
Link
component and the external componentLink
component and the external component, the external component props will override the ones applied to theLink
componentThe idea is that we update all link components to allow for this. Curious to know what you think!
UPDATE
It looked like no apps were using the
Link
component, so I updated theBreadcrumb
component as well to check how it would look in other applications. I went ahead and removed the string interpolation on the href from the base react-uiBreadcrumb
component to the docs and updated the implementation with this new approach. The result is cleaner html!