import type { Meta, StoryObj } from '@storybook/nextjs' import { useMemo, useState } from 'react' import SimplePieChart from '.' const PieChartPlayground = ({ initialPercentage = 65, fill = '#fdb022', stroke = '#f79009', }: { initialPercentage?: number fill?: string stroke?: string }) => { const [percentage, setPercentage] = useState(initialPercentage) const label = useMemo(() => `${percentage}%`, [percentage]) return (
Conversion snapshot {label}
setPercentage(Number.parseInt(event.target.value, 10))} className="h-2 w-full cursor-pointer appearance-none rounded-full bg-divider-subtle accent-primary-600" />
) } const meta = { title: 'Base/Data Display/SimplePieChart', component: PieChartPlayground, parameters: { layout: 'centered', docs: { description: { component: 'Thin radial indicator built with ECharts. Use it for quick percentage snapshots inside cards.', }, }, }, argTypes: { initialPercentage: { control: { type: 'range', min: 0, max: 100, step: 1 }, }, fill: { control: 'color' }, stroke: { control: 'color' }, }, args: { initialPercentage: 65, fill: '#fdb022', stroke: '#f79009', }, tags: ['autodocs'], } satisfies Meta export default meta type Story = StoryObj export const Playground: Story = {} export const BrandAccent: Story = { args: { fill: '#155EEF', stroke: '#0040C1', initialPercentage: 82, }, }