From e0ced28ac1797b11862adac142d2019488cfdcc9 Mon Sep 17 00:00:00 2001 From: R894 <54629307+R894@users.noreply.github.com> Date: Tue, 16 Apr 2024 02:56:51 +0300 Subject: [PATCH] feat: add HBarChart variations to stories (#669) --- .storybook/preview.tsx | 14 +++--- .../OperatorHbarChart.stories.tsx | 30 +++++++++++++ .../LineHbarChart/LinesHBarChart.stories.tsx | 44 +++++++++++++++++++ 3 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 src/pages/dashboard/AllLineschart/OperatorHbarChart/OperatorHbarChart.stories.tsx create mode 100644 src/pages/dashboard/WorstLinesChart/LineHbarChart/LinesHBarChart.stories.tsx diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 7cf081fa..4f79ce99 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -1,5 +1,6 @@ import type { Preview } from '@storybook/react' import React from 'react' +import i18n from 'src/locale/allTranslations' const preview: Preview = { parameters: { @@ -12,11 +13,14 @@ const preview: Preview = { }, }, decorators: [ - (Story) => ( -
- -
- ), + (Story) => { + i18n + return ( +
+ +
+ ) + }, ], } diff --git a/src/pages/dashboard/AllLineschart/OperatorHbarChart/OperatorHbarChart.stories.tsx b/src/pages/dashboard/AllLineschart/OperatorHbarChart/OperatorHbarChart.stories.tsx new file mode 100644 index 00000000..d7940516 --- /dev/null +++ b/src/pages/dashboard/AllLineschart/OperatorHbarChart/OperatorHbarChart.stories.tsx @@ -0,0 +1,30 @@ +import { Meta, StoryObj } from '@storybook/react' +import OperatorHbarChart from './OperatorHbarChart' + +const meta: Meta = { + title: 'Components/MapLayers/HbarChart/OperatorHbarChart', + component: OperatorHbarChart, + tags: ['autodocs'], +} + +export default meta +type Story = StoryObj + +const mockOperatorsData = [ + { + name: 'אגד', + total: 10, + actual: 5, + }, + { + name: 'סופרבוס', + total: 8, + actual: 3, + }, +] + +export const Default: Story = { + args: { + operators: mockOperatorsData, + }, +} diff --git a/src/pages/dashboard/WorstLinesChart/LineHbarChart/LinesHBarChart.stories.tsx b/src/pages/dashboard/WorstLinesChart/LineHbarChart/LinesHBarChart.stories.tsx new file mode 100644 index 00000000..ced87214 --- /dev/null +++ b/src/pages/dashboard/WorstLinesChart/LineHbarChart/LinesHBarChart.stories.tsx @@ -0,0 +1,44 @@ +import { Meta, StoryObj } from '@storybook/react' +import LinesHbarChart from './LinesHbarChart' + +const meta: Meta = { + title: 'Components/MapLayers/HbarChart/LinesHBarChart', + component: LinesHbarChart, + tags: ['autodocs'], +} + +export default meta +type Story = StoryObj +const mockLines = [ + { + id: '1', + short_name: '5', + long_name: 'Long Name 1', + operator_name: 'אגד', + total: 10000, + actual: 6000, + }, + { + id: '2', + short_name: '8', + long_name: 'Long Name 2', + operator_name: 'אלקטרה אפיקים', + total: 10000, + actual: 7000, + }, + { + id: '3', + short_name: '10', + long_name: 'Long Name 3', + operator_name: 'סופרבוס', + total: 10000, + actual: 8000, + }, +] + +export const Default: Story = { + args: { + lines: mockLines, + complement: false, + }, +}