Skip to content
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

@/commons-ui-next/Link App Router support #877

Merged
merged 11 commits into from
Sep 6, 2024

Conversation

kilemensi
Copy link
Member

Description

The current @commons-ui/next/Link depends on useRouter from Next.js Pages Router application. This means an error is thrown when the component is used in an App Router application.

This PR fixes this by:

  1. Moving all Pages Router specific features from Link to the PagesRouterLink component.
  2. Renaming Link to StyledLink component keeping only Next/Link and @mui/material/Link functionality
  3. Exports PagesRouterLink as default Link component to ensure no existing app is broken.
  4. Exports both PagesRouterLink and StyledLink as components that can be imported from @commons-i/next package
  5. Uses StyledLink in @/engineeringblog app.

Type of change

  • Chore

Screenshots

N/A

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@kilemensi kilemensi added the chore A task that needs to be done (neither enhancement or bug) label Sep 6, 2024
@kilemensi kilemensi self-assigned this Sep 6, 2024
@kilemensi kilemensi requested a review from a team September 6, 2024 11:32
Copy link
Contributor

github-actions bot commented Sep 6, 2024

Latest updated Preview URL

Name Review
codeforafrica-ui-pr-877 Visit

Copy link
Contributor

@kelvinkipruto kelvinkipruto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kilemensi kilemensi added this pull request to the merge queue Sep 6, 2024
Merged via the queue into main with commit 1293a12 Sep 6, 2024
6 checks passed
@kilemensi kilemensi deleted the fix/commons_ui_next_link_router branch September 6, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore A task that needs to be done (neither enhancement or bug)
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants