-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Link): add react-router link integration (#294)
Well this took some experimentation, but we got there. Allows `Link` to use a `isRouterLink` prop to convert them to `react-router` links with minimal hassle. ## Changes - add `react-router-dom` as an external dependency in the vite config, since `react-router` needs its links to share the same instance of the library to work. Works in concert [with this change](https://github.com/cfpb/sbl-frontend/compare/198-integrate-react-router-links?expand=1#diff-6a3b01ba97829c9566ef2d8dc466ffcffb4bdac08706d3d6319e42e0aa6890ddR26-R28) in `sbl-frontend`. What a pain this was. (Also, I added a maybe missing `react-dom` from the `optimizeDeps.exclude` array for good measure) - add a `isRouterLink` prop that switches `Link` to using `react-router` Links - fixes some Typescript errors - adds a story for `isRouterLink` prop called "Link using React Router Link" ## How to test this PR 1. Does the `isRouterLink` story "Link using React Router Link" render without errors? ## Screenshots ![Screenshot 2024-01-29 at 11 15 16 PM](https://github.com/cfpb/design-system-react/assets/19983248/a3c9e483-945c-423c-9efa-1bf08bd8b5cd) ## Notes - I could have also added a `NavLink` option, but I don't think we have a use case for it since we have some similar logic built out already. I made [a ticket for it](#293), in case we want to add it in. - Enables this PR on sbl-frontend: cfpb/sbl-frontend#201
- Loading branch information
1 parent
a59765e
commit d3888b7
Showing
4 changed files
with
55 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters