Skip to content

Commit

Permalink
feat: breadcrumbs should not inherit the new link style (#271) (#280)
Browse files Browse the repository at this point in the history
Co-authored-by: Fran McDade <[email protected]>
  • Loading branch information
frano-m and Fran McDade authored Nov 21, 2024
1 parent 2296bc8 commit bae0178
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/common/Breadcrumbs/breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Link, Breadcrumbs as MBreadcrumbs, Typography } from "@mui/material";
import NLink from "next/link";
import React, { ReactNode } from "react";
import { BaseComponentProps } from "../../types";
import { LINK_PROPS } from "./constants";

export interface Breadcrumb {
path: string;
Expand All @@ -25,7 +26,7 @@ export const Breadcrumbs = ({
<MBreadcrumbs className={className} separator={Separator}>
{breadcrumbs.map(({ path, text }, b) =>
path ? (
<Link component={NLink} key={b} href={path}>
<Link {...LINK_PROPS} component={NLink} key={b} href={path}>
{text}
</Link>
) : (
Expand Down
6 changes: 6 additions & 0 deletions src/components/common/Breadcrumbs/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LinkProps } from "@mui/material";
import { LINK_PROPS as MUI_LINK_PROPS } from "../../../styles/common/mui/link";

export const LINK_PROPS: Partial<LinkProps> = {
underline: MUI_LINK_PROPS.UNDERLINE.HOVER,
};
15 changes: 15 additions & 0 deletions src/styles/common/mui/link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { LinkProps } from "@mui/material";

type LinkPropsOptions = {
UNDERLINE: typeof UNDERLINE;
};

export const UNDERLINE: Record<string, LinkProps["underline"]> = {
ALWAYS: "always",
HOVER: "hover",
NONE: "none",
};

export const LINK_PROPS: LinkPropsOptions = {
UNDERLINE,
};

0 comments on commit bae0178

Please sign in to comment.