返回 marp
Breadcrumb.tsx
根目录 / website / components / docs / Breadcrumb.tsx
1 import Link from 'next/link'
2
3 export type BreadcrumbProps = {
4 breadcrumbs: {
5 key: string
6 link?: string
7 title: string
8 }[]
9 }
10
11 export const Breadcrumb = ({ breadcrumbs }: BreadcrumbProps) => (
12 <ol>
13 {breadcrumbs.map(({ key, title, link }) => (
14 <li key={key}>{link ? <Link href={link}>{title}</Link> : title}</li>
15 ))}
16 <style jsx>{`
17 ol {
18 @apply inline-flex flex-1 flex-nowrap whitespace-nowrap;
19 }
20 li {
21 @apply block;
22 }
23 li::after {
24 @apply bg-no-repeat pl-6;
25
26 background-image: url('https://icongr.am/octicons/triangle-right.svg?color=718096');
27 background-position: 0.25rem center;
28 background-size: 1rem 1rem;
29 content: '';
30 }
31 li:last-child {
32 @apply font-bold;
33 }
34 li:last-child::after {
35 @apply hidden;
36 }
37 `}</style>
38 </ol>
39 )
40
40 lines Plain Text