File tree Expand file tree Collapse file tree 3 files changed +86
-0
lines changed
Expand file tree Collapse file tree 3 files changed +86
-0
lines changed Original file line number Diff line number Diff line change 1+ import Breadcrumb from './Breadcrumb' ;
2+
3+ // Example usage in a Dashboard page
4+ export const DashboardBreadcrumb = ( ) => {
5+ return (
6+ < Breadcrumb
7+ items = { [
8+ { label : 'Home' , href : '/' } ,
9+ { label : 'Dashboard' }
10+ ] }
11+ />
12+ ) ;
13+ } ;
14+
15+ // Example usage in a Profile page
16+ export const ProfileBreadcrumb = ( ) => {
17+ return (
18+ < Breadcrumb
19+ items = { [
20+ { label : 'Home' , href : '/' } ,
21+ { label : 'Settings' , href : '/settings' } ,
22+ { label : 'Profile' }
23+ ] }
24+ />
25+ ) ;
26+ } ;
27+
28+ // Example usage with nested navigation
29+ export const AssetDetailBreadcrumb = ( ) => {
30+ return (
31+ < Breadcrumb
32+ items = { [
33+ { label : 'Home' , href : '/' } ,
34+ { label : 'Assets' , href : '/assets' } ,
35+ { label : 'Equipment' , href : '/assets/equipment' } ,
36+ { label : 'Laptop #12345' }
37+ ] }
38+ />
39+ ) ;
40+ } ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import Link from 'next/link' ;
3+
4+ interface BreadcrumbItem {
5+ label : string ;
6+ href ?: string ;
7+ }
8+
9+ interface BreadcrumbProps {
10+ items : BreadcrumbItem [ ] ;
11+ }
12+
13+ const Breadcrumb : React . FC < BreadcrumbProps > = ( { items } ) => {
14+ return (
15+ < nav aria-label = "Breadcrumb" className = "flex gap-2 text-sm" >
16+ { items . map ( ( item , index ) => {
17+ const isLast = index === items . length - 1 ;
18+
19+ return (
20+ < React . Fragment key = { index } >
21+ { isLast ? (
22+ < span className = "text-gray-600 font-medium" aria-current = "page" >
23+ { item . label }
24+ </ span >
25+ ) : (
26+ < React . Fragment >
27+ < Link
28+ href = { item . href || '#' }
29+ className = "text-blue-600 hover:text-blue-800 hover:underline transition-colors"
30+ >
31+ { item . label }
32+ </ Link >
33+ < span className = "text-gray-400" aria-hidden = "true" >
34+ /
35+ </ span >
36+ </ React . Fragment >
37+ ) }
38+ </ React . Fragment >
39+ ) ;
40+ } ) }
41+ </ nav >
42+ ) ;
43+ } ;
44+
45+ export default Breadcrumb ;
Original file line number Diff line number Diff line change 1+ export { default as Breadcrumb } from './Breadcrumb' ;
You can’t perform that action at this time.
0 commit comments