Skip to content

Commit

Permalink
feat: add HBarChart variations to stories (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
R894 authored Apr 15, 2024
1 parent 390fe95 commit e0ced28
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Preview } from '@storybook/react'
import React from 'react'
import i18n from 'src/locale/allTranslations'

const preview: Preview = {
parameters: {
Expand All @@ -12,11 +13,14 @@ const preview: Preview = {
},
},
decorators: [
(Story) => (
<div style={{ direction: 'rtl' }}>
<Story />
</div>
),
(Story) => {
i18n
return (
<div style={{ direction: 'rtl' }}>
<Story />
</div>
)
},
],
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Meta, StoryObj } from '@storybook/react'
import OperatorHbarChart from './OperatorHbarChart'

const meta: Meta<typeof OperatorHbarChart> = {
title: 'Components/MapLayers/HbarChart/OperatorHbarChart',
component: OperatorHbarChart,
tags: ['autodocs'],
}

export default meta
type Story = StoryObj<typeof OperatorHbarChart>

const mockOperatorsData = [
{
name: 'אגד',
total: 10,
actual: 5,
},
{
name: 'סופרבוס',
total: 8,
actual: 3,
},
]

export const Default: Story = {
args: {
operators: mockOperatorsData,
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Meta, StoryObj } from '@storybook/react'
import LinesHbarChart from './LinesHbarChart'

const meta: Meta<typeof LinesHbarChart> = {
title: 'Components/MapLayers/HbarChart/LinesHBarChart',
component: LinesHbarChart,
tags: ['autodocs'],
}

export default meta
type Story = StoryObj<typeof LinesHbarChart>
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,
},
}

0 comments on commit e0ced28

Please sign in to comment.