Major categories fixed: - TS6133 (188): Remove unused imports (React, icons, types) and variables - TS2322 (222): Fix type mismatches in stories (satisfies Meta -> const meta: Meta), add nullish coalescing for optional values, fix component prop types - TS2345 (43): Fix argument type mismatches with proper null checks and type narrowing - TS2741 (21): Add missing required properties to mock/story data - TS2339 (19): Fix property access on incorrect types, add type guards - TS2353 (13): Remove extra properties from object literals or extend interfaces - TS2352 (11): Fix type conversion chains - TS2307 (9): Fix import paths and module references - Other (42): Fix implicit any, possibly undefined, export declarations Vite build and tsc --noEmit both pass cleanly. Co-authored-by: Cursor <cursoragent@cursor.com>
86 lines
2.1 KiB
TypeScript
86 lines
2.1 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react';
|
|
import { VolumeControl } from './VolumeControl';
|
|
import { useState } from 'react';
|
|
|
|
const meta: Meta = {
|
|
title: 'Components/Features/Player/Components/VolumeControl',
|
|
component: VolumeControl,
|
|
tags: ['autodocs'],
|
|
argTypes: {
|
|
volume: { control: { type: 'range', min: 0, max: 100 } },
|
|
muted: { control: 'boolean' },
|
|
disabled: { control: 'boolean' },
|
|
showValue: { control: 'boolean' },
|
|
showSlider: { control: 'boolean' },
|
|
},
|
|
decorators: [
|
|
(Story) => (
|
|
<div className="p-4 w-64 bg-muted rounded-lg">
|
|
<Story />
|
|
</div>
|
|
),
|
|
],
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Default: Story = {
|
|
render: (args) => {
|
|
const [volume, setVolume] = useState(50);
|
|
const [muted, setMuted] = useState(false);
|
|
|
|
return (
|
|
<VolumeControl
|
|
{...args}
|
|
volume={volume}
|
|
muted={muted}
|
|
onVolumeChange={setVolume}
|
|
onMuteToggle={() => setMuted(!muted)}
|
|
/>
|
|
);
|
|
},
|
|
};
|
|
|
|
export const Muted: Story = {
|
|
render: (args) => {
|
|
const [volume, setVolume] = useState(50);
|
|
const [muted, setMuted] = useState(true);
|
|
|
|
return (
|
|
<VolumeControl
|
|
{...args}
|
|
volume={volume}
|
|
muted={muted}
|
|
onVolumeChange={setVolume}
|
|
onMuteToggle={() => setMuted(!muted)}
|
|
/>
|
|
);
|
|
},
|
|
};
|
|
|
|
export const Disabled: Story = {
|
|
args: {
|
|
volume: 30,
|
|
muted: false,
|
|
disabled: true,
|
|
},
|
|
};
|
|
|
|
export const WithValue: Story = {
|
|
render: (args) => {
|
|
const [volume, setVolume] = useState(75);
|
|
const [muted, setMuted] = useState(false);
|
|
|
|
return (
|
|
<VolumeControl
|
|
{...args}
|
|
volume={volume}
|
|
muted={muted}
|
|
showValue={true}
|
|
onVolumeChange={setVolume}
|
|
onMuteToggle={() => setMuted(!muted)}
|
|
/>
|
|
);
|
|
},
|
|
};
|