testing: add `StandardGauge` stories

This commit is contained in:
Rickard Andersson 2023-08-10 15:16:40 +03:00
parent d3502e0dc3
commit 7c2dcab837
2 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,37 @@
import type { Meta, StoryObj } from '@storybook/react'
import StandardGauge from './StandardGauge'
const meta = {
title: 'General/StandardGauge',
component: StandardGauge,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
decorators: [
Story => (
<div style={{ height: '25vh' }}>
<Story />
</div>
),
],
} satisfies Meta<typeof StandardGauge>
export default meta
type Story = StoryObj<typeof meta>
export const WithDataPoints: Story = {
args: {
data: [
{ id: '1', color: 'red', label: 'Red', value: 42 },
{ id: '2', color: 'blue', label: 'Blue', value: 1337 },
],
},
}
export const WithoutDataPoints: Story = {
args: {
data: [],
},
}

View File

@ -1,13 +1,14 @@
import { ResponsivePie } from '@nivo/pie'
interface Data {
export interface GaugeDataPoint {
id: string
label: string
value: number
color: string
}
interface StandardGaugeProps {
data: Data[]
data: GaugeDataPoint[]
}
const StandardGauge = ({ data }: StandardGaugeProps) => (