Skip to content

Commit 65877fa

Browse files
committed
Restyle Breadcrumbs
1 parent 5b41f5b commit 65877fa

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed
Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,24 @@ import NextLink from "next/link"
44
import { ArrowRightIcon } from "nextra/icons"
55
import type { Item } from "nextra/normalize-pages"
66

7-
import { extractStringsFromReactNode } from "../../components/utils/extract-strings-from-react-node"
7+
import CaretDown from "@/app/conf/_design-system/pixelarticons/caret-down.svg?svgr"
88

9-
export const Breadcrumbs = ({ activePath }: { activePath: Item[] }) => {
9+
import { extractStringsFromReactNode } from "../components/utils/extract-strings-from-react-node"
10+
11+
export const Breadcrumbs = ({
12+
activePath,
13+
className,
14+
}: {
15+
activePath: Item[]
16+
className?: string
17+
}) => {
1018
return (
11-
<div className="x:mt-1.5 x:flex x:items-center x:gap-1 x:overflow-hidden x:text-sm x:text-gray-600 x:dark:text-gray-400 x:contrast-more:text-current">
19+
<div
20+
className={clsx(
21+
"typography-menu flex items-center gap-1 overflow-hidden text-sm",
22+
className,
23+
)}
24+
>
1225
{activePath.map((item, index, arr) => {
1326
const nextItem = arr[index + 1]
1427
const href = nextItem
@@ -22,21 +35,15 @@ export const Breadcrumbs = ({ activePath }: { activePath: Item[] }) => {
2235

2336
const title = extractStringsFromReactNode(item.title)
2437
const className = clsx(
25-
"x:whitespace-nowrap x:transition-colors",
26-
nextItem
27-
? "x:min-w-6 x:overflow-hidden x:text-ellipsis"
28-
: "x:font-medium x:text-black x:dark:text-gray-100",
38+
"truncate text-neu-700 dark:text-neu-400 min-w-6 last:text-neu-800 dark:last:text-neu-800 leading-none",
2939
href &&
30-
"x:focus-visible:nextra-focus x:ring-inset x:hover:text-gray-900 x:dark:hover:text-gray-100",
40+
"focus-visible:gql-focus-visible ring-inset hover:text-neu-900 hover:underline",
3141
)
3242

3343
return (
3444
<Fragment key={item.route + item.name}>
3545
{index > 0 && (
36-
<ArrowRightIcon
37-
height="14"
38-
className="x:shrink-0 x:rtl:rotate-180"
39-
/>
46+
<CaretDown className="size-4 translate-x-[0.5px] -rotate-90" />
4047
)}
4148
{href ? (
4249
<NextLink href={href} title={title} prefetch={false}>

src/components/nextra-mdx-wrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function Body({ children }: { children: ReactNode }): ReactElement {
146146
>
147147
<main className="w-full min-w-0 max-w-6xl px-6 pt-4 md:px-12">
148148
{activeType !== "page" && themeContext.breadcrumb && (
149-
<Breadcrumbs activePath={activePath} />
149+
<Breadcrumbs activePath={activePath} className="mt-1.5" />
150150
)}
151151
{body}
152152
</main>

0 commit comments

Comments
 (0)