testing: add `StandardGauge` stories
This commit is contained in:
parent
d3502e0dc3
commit
7c2dcab837
|
@ -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: [],
|
||||
},
|
||||
}
|
|
@ -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) => (
|
||||
|
|
Loading…
Reference in New Issue