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>
75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
import React from 'react';
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
import { Sidebar } from './Sidebar';
|
|
import { Filter, User } from 'lucide-react';
|
|
|
|
const meta = {
|
|
title: 'UI/Sidebar',
|
|
component: Sidebar,
|
|
tags: ['autodocs'],
|
|
argTypes: {
|
|
position: {
|
|
control: 'radio',
|
|
options: ['left', 'right'],
|
|
},
|
|
width: { control: 'text' },
|
|
collapsible: { control: 'boolean' },
|
|
},
|
|
parameters: {
|
|
layout: 'fullscreen',
|
|
},
|
|
decorators: [
|
|
(Story) => (
|
|
<div className="h-[500px] w-full relative flex border bg-background">
|
|
<Story />
|
|
<div className="flex-1 p-8">
|
|
<h1 className="text-2xl font-bold mb-4">Main Content</h1>
|
|
<p className="text-muted-foreground">
|
|
The sidebar sits alongside this content.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
),
|
|
],
|
|
} satisfies Meta<typeof Sidebar>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const LeftSidebar: Story = {
|
|
args: {
|
|
title: 'Filters',
|
|
icon: <Filter className="w-4 h-4" />,
|
|
position: 'left',
|
|
children: (
|
|
<div className="p-4 space-y-4">
|
|
<div className="h-20 bg-white/5 rounded-md" />
|
|
<div className="h-20 bg-white/5 rounded-md" />
|
|
<div className="h-20 bg-white/5 rounded-md" />
|
|
</div>
|
|
),
|
|
},
|
|
};
|
|
|
|
export const RightSidebar: Story = {
|
|
args: {
|
|
title: 'User Profile',
|
|
icon: <User className="w-4 h-4" />,
|
|
position: 'right',
|
|
children: (
|
|
<div className="p-4 space-y-4">
|
|
<div className="text-sm text-muted-foreground">User details go here</div>
|
|
</div>
|
|
),
|
|
},
|
|
decorators: [
|
|
(Story: React.ComponentType) => (
|
|
<div className="h-[500px] w-full relative flex border bg-background">
|
|
<div className="flex-1 p-8">
|
|
<h1 className="text-2xl font-bold mb-4">Main Content</h1>
|
|
</div>
|
|
<Story />
|
|
</div>
|
|
),
|
|
],
|
|
};
|