dify/web/app/components/base/tab-slider-plain/index.stories.tsx
Stephen Zhou a84c2d36a3
style: format with vp fmt (#38803)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-12 15:57:46 +00:00

50 lines
1.4 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import { useState } from 'react'
import TabSliderPlain from '.'
const OPTIONS = [
{ value: 'analytics', text: 'Analytics' },
{ value: 'activity', text: 'Recent activity' },
{ value: 'alerts', text: 'Alerts' },
]
const TabSliderPlainDemo = ({ initialValue = 'analytics' }: { initialValue?: string }) => {
const [value, setValue] = useState(initialValue)
return (
<div className="flex w-full max-w-2xl flex-col gap-4 rounded-2xl border border-divider-subtle bg-components-panel-bg p-6">
<div className="text-xs tracking-[0.18em] text-text-tertiary uppercase">Underline tabs</div>
<TabSliderPlain value={value} onChange={setValue} options={OPTIONS} />
</div>
)
}
const meta = {
title: 'Base/Navigation/TabSliderPlain',
component: TabSliderPlainDemo,
parameters: {
layout: 'centered',
docs: {
description: {
component:
'Underline-style navigation commonly used in dashboards. Toggle between three sections.',
},
},
},
argTypes: {
initialValue: {
control: 'radio',
options: OPTIONS.map((option) => option.value),
},
},
args: {
initialValue: 'analytics',
},
tags: ['autodocs'],
} satisfies Meta<typeof TabSliderPlainDemo>
export default meta
type Story = StoryObj<typeof meta>
export const Playground: Story = {}