|
26 | 26 | collapseOnMobile = false,
|
27 | 27 | inverse = false,
|
28 | 28 | ariaLabel = "Breadcrumb",
|
| 29 | + formatBreadcrumbText, |
29 | 30 | } = $props<{
|
30 | 31 | items?: BreadcrumbItem[];
|
31 | 32 | collapseOnMobile?: boolean;
|
32 | 33 | inverse?: boolean;
|
33 | 34 | ariaLabel?: string;
|
| 35 | + formatBreadcrumbText?: (text: string[]) => string; |
34 | 36 | }>();
|
35 | 37 |
|
36 | 38 | // Load all page modules for route detection
|
|
53 | 55 |
|
54 | 56 | // Effect to update breadcrumb items when dependencies change
|
55 | 57 | $effect(() => {
|
56 |
| - breadcrumbItems = items || generateBreadcrumbItems(page, routeModules); |
| 58 | + breadcrumbItems = generateBreadcrumbItems(page, routeModules); |
57 | 59 | });
|
58 | 60 |
|
59 | 61 | // Generate breadcrumb items from the current route
|
|
156 | 158 | /**
|
157 | 159 | * Converts route segments to human-readable text
|
158 | 160 | */
|
159 |
| - function formatBreadcrumbText(text: string): string { |
| 161 | + /*function formatBreadcrumbText(text: string): string { |
160 | 162 | // Handle special cases
|
161 |
| - if (text === "ui") return "UI Components"; |
162 |
| - if (text === "data-vis") return "Data Visualization"; |
163 |
| - if (text === "content") return "Content Components"; |
164 |
| - if (text === "layout") return "Layout Components"; |
165 |
| - if (text === "user-guide") return "User Guide"; |
166 |
| - if (text === "playground") return "Playground"; |
167 |
| - if (text === "components") return "Components"; |
168 |
| - if (text === "local-lib") return "Local Library"; |
| 163 | + const urlLookupObject = { |
| 164 | + ui: "UI Components", |
| 165 | + "data-vis": "Data Visualization", |
| 166 | + }; |
169 | 167 |
|
170 | 168 | // Default: capitalize and replace hyphens with spaces
|
171 |
| - return text |
| 169 | + return (text in urlLookupObject ? urlLookupObject[text] : text) |
172 | 170 | .split("-")
|
173 | 171 | .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
174 | 172 | .join(" ");
|
175 |
| - } |
| 173 | + }*/ |
176 | 174 | </script>
|
177 | 175 |
|
178 | 176 | <nav
|
|
0 commit comments