-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update comps to use Nav helpers,classNames
- Loading branch information
1 parent
6c4fe9b
commit d34b7ac
Showing
6 changed files
with
67 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { forwardRef } from "react"; | ||
import { Link as RRDomLink } from "react-router-dom"; | ||
import { Link as ReactRouterDomLink } from "react-router-dom"; | ||
import { styled } from "@mui/material/styles"; | ||
import { useMaybeRef, type MaybeRef } from "@hooks/useMaybeRef"; | ||
import { defaultLinkStyles } from "./styles"; | ||
import { useMaybeRef } from "@/hooks/useMaybeRef"; | ||
import { getDefaultLinkStyles } from "./styles"; | ||
|
||
/** | ||
* A styled react-router-dom Link with ref forwarding. | ||
* A styled react-router-dom `Link` with ref forwarding. | ||
*/ | ||
export const Link = forwardRef<MaybeRef<HTMLAnchorElement>, LinkProps>(function Link( | ||
{ to, children, ...props }, | ||
export const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link( | ||
{ to, children, ...linkProps }, | ||
ref | ||
) { | ||
const anchorRef = useMaybeRef(ref); | ||
|
||
return ( | ||
<StyledLink ref={anchorRef} to={to} {...props}> | ||
<StyledReactRouterDomLink ref={anchorRef} to={to} {...linkProps}> | ||
{children} | ||
</StyledLink> | ||
</StyledReactRouterDomLink> | ||
); | ||
}); | ||
|
||
export const StyledLink = styled(RRDomLink)(defaultLinkStyles); | ||
export const StyledReactRouterDomLink = styled(ReactRouterDomLink)(getDefaultLinkStyles); | ||
|
||
export type LinkProps = React.ComponentProps<typeof StyledLink>; | ||
export type LinkProps = React.ComponentProps<typeof StyledReactRouterDomLink>; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Class names for `Navigation` components (src/components/Navigation/). | ||
*/ | ||
export const navigationClassNames = { | ||
legalLinksContainer: "legal-links-container", | ||
|
||
navLinkPending: "rrd-nav-link-pending", | ||
} as const; |