From 609cc91e6b7909cb64b50e37c282643a46f5f8d1 Mon Sep 17 00:00:00 2001 From: cudiousidy Date: Tue, 26 May 2026 14:37:39 +0200 Subject: [PATCH 1/2] feat(breadcrumb): add molecule component --- .storybook/withDarkMode.tsx | 4 +- .../breadcrumb/Breadcrumb.stories.tsx | 119 ++++++++++ .../molecules/breadcrumb/Breadcrumb.test.tsx | 158 +++++++++++++ .../molecules/breadcrumb/Breadcrumb.tsx | 219 ++++++++++++++++++ src/components/molecules/breadcrumb/index.ts | 2 + src/components/molecules/breadcrumb/types.ts | 96 ++++++++ .../molecules/breadcrumb/useBreadcrumb.ts | 92 ++++++++ src/index.ts | 57 ++--- 8 files changed, 717 insertions(+), 30 deletions(-) create mode 100644 src/components/molecules/breadcrumb/Breadcrumb.stories.tsx create mode 100644 src/components/molecules/breadcrumb/Breadcrumb.test.tsx create mode 100644 src/components/molecules/breadcrumb/Breadcrumb.tsx create mode 100644 src/components/molecules/breadcrumb/index.ts create mode 100644 src/components/molecules/breadcrumb/types.ts create mode 100644 src/components/molecules/breadcrumb/useBreadcrumb.ts diff --git a/.storybook/withDarkMode.tsx b/.storybook/withDarkMode.tsx index 7534b4ca..4f4b00e6 100644 --- a/.storybook/withDarkMode.tsx +++ b/.storybook/withDarkMode.tsx @@ -7,7 +7,7 @@ export const withDarkMode: Decorator = (Story) => { // Use useLayoutEffect to apply changes BEFORE paint (prevents flicker) useLayoutEffect(() => { - // Set background colors (the addon handles the 'dark' class automatically) + // Set background colors before applying the wrapper-level dark class below. const bg = isDark ? '#060C13' : '#f4f5f7'; document.documentElement.style.background = bg; document.body.style.background = bg; @@ -15,7 +15,7 @@ export const withDarkMode: Decorator = (Story) => { return (
= { + title: 'Molecules/Breadcrumb', + component: Breadcrumb, + parameters: { + docs: { + autodocs: true + } + }, + tags: ['autodocs'] +}; + +export default meta; + +type Story = StoryObj; + +const items: BreadcrumbItem[] = [ + { title: 'Home', href: '/' }, + { title: 'Components', href: '/components' }, + { title: 'Breadcrumb', href: '/components/breadcrumb' } +]; + +const itemsWithContent: BreadcrumbItem[] = [ + { title: 'Home', href: '/', startContent: 'house' }, + { title: 'Library', href: '/library', endContent: 'chevron-right' }, + { + title: 'Documentation', + href: '/docs', + startContent: