From bae017818f3c13aea39530e9e7a1a9dd63123f1a Mon Sep 17 00:00:00 2001 From: Fran McDade Date: Thu, 21 Nov 2024 16:55:29 +1000 Subject: [PATCH] feat: breadcrumbs should not inherit the new link style (#271) (#280) Co-authored-by: Fran McDade --- src/components/common/Breadcrumbs/breadcrumbs.tsx | 3 ++- src/components/common/Breadcrumbs/constants.ts | 6 ++++++ src/styles/common/mui/link.ts | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/components/common/Breadcrumbs/constants.ts create mode 100644 src/styles/common/mui/link.ts diff --git a/src/components/common/Breadcrumbs/breadcrumbs.tsx b/src/components/common/Breadcrumbs/breadcrumbs.tsx index bd88012..d2264cf 100644 --- a/src/components/common/Breadcrumbs/breadcrumbs.tsx +++ b/src/components/common/Breadcrumbs/breadcrumbs.tsx @@ -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; @@ -25,7 +26,7 @@ export const Breadcrumbs = ({ {breadcrumbs.map(({ path, text }, b) => path ? ( - + {text} ) : ( diff --git a/src/components/common/Breadcrumbs/constants.ts b/src/components/common/Breadcrumbs/constants.ts new file mode 100644 index 0000000..e0eefea --- /dev/null +++ b/src/components/common/Breadcrumbs/constants.ts @@ -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 = { + underline: MUI_LINK_PROPS.UNDERLINE.HOVER, +}; diff --git a/src/styles/common/mui/link.ts b/src/styles/common/mui/link.ts new file mode 100644 index 0000000..23f7308 --- /dev/null +++ b/src/styles/common/mui/link.ts @@ -0,0 +1,15 @@ +import { LinkProps } from "@mui/material"; + +type LinkPropsOptions = { + UNDERLINE: typeof UNDERLINE; +}; + +export const UNDERLINE: Record = { + ALWAYS: "always", + HOVER: "hover", + NONE: "none", +}; + +export const LINK_PROPS: LinkPropsOptions = { + UNDERLINE, +};