From 146fc44b46a645c83fae83216904af4c4f3c1543 Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Mon, 29 Apr 2024 22:47:45 +0300 Subject: [PATCH] fix(breadcrumb-stories): add examples and router decorator --- src/components/General/Breadcrumb/Breadcrumb.stories.tsx | 2 ++ .../General/Breadcrumb/BreadcrumbElement.stories.tsx | 8 ++++++-- src/components/General/Breadcrumb/BreadcrumbElement.tsx | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/General/Breadcrumb/Breadcrumb.stories.tsx b/src/components/General/Breadcrumb/Breadcrumb.stories.tsx index 6ce97050..2b00ad06 100644 --- a/src/components/General/Breadcrumb/Breadcrumb.stories.tsx +++ b/src/components/General/Breadcrumb/Breadcrumb.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' +import { withRouter } from 'storybook-addon-react-router-v6' import Breadcrumb from './Breadcrumb' @@ -8,6 +9,7 @@ const meta = { parameters: { layout: 'top', }, + decorators: [withRouter()], tags: ['autodocs'], } satisfies Meta diff --git a/src/components/General/Breadcrumb/BreadcrumbElement.stories.tsx b/src/components/General/Breadcrumb/BreadcrumbElement.stories.tsx index c4e30b59..af1027dd 100644 --- a/src/components/General/Breadcrumb/BreadcrumbElement.stories.tsx +++ b/src/components/General/Breadcrumb/BreadcrumbElement.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' +import { withRouter } from 'storybook-addon-react-router-v6' import BreadcrumbElement from './BreadcrumbElement' @@ -8,6 +9,7 @@ const meta = { parameters: { layout: 'top', }, + decorators: [withRouter()], tags: ['autodocs'], } satisfies Meta @@ -16,14 +18,16 @@ type Story = StoryObj export const Default: Story = { args: { - element: 'Nodes', + breadcrumb: 'Nodes', + match: { pathname: '/nodes' }, isLastElement: false, }, } export const LastElement: Story = { args: { - element: 'Nodes', + breadcrumb: 'Nodes', + match: { pathname: '/nodes' }, isLastElement: true, }, } diff --git a/src/components/General/Breadcrumb/BreadcrumbElement.tsx b/src/components/General/Breadcrumb/BreadcrumbElement.tsx index 455ef283..b9cd6ec3 100644 --- a/src/components/General/Breadcrumb/BreadcrumbElement.tsx +++ b/src/components/General/Breadcrumb/BreadcrumbElement.tsx @@ -16,7 +16,6 @@ const BreadcrumbElement = ({ return (