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

feat: breadcrumbs should not inherit the new link style (#271) #280

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};