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}
)
}
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,
},
}