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>
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react';
|
|
import { fn } from '@storybook/test';
|
|
import { CourseCard } from './CourseCard';
|
|
import { Course } from '../../types';
|
|
|
|
const mockCourse: Course = {
|
|
id: 'c1',
|
|
title: 'Advanced Sound Design',
|
|
instructor: 'Alex Sound',
|
|
thumbnailUrl: 'https://picsum.photos/id/100/400/250',
|
|
level: 'Advanced',
|
|
duration: '4h 30m',
|
|
rating: 4.8,
|
|
studentCount: 1200,
|
|
price: 49.99,
|
|
progress: 0,
|
|
};
|
|
|
|
const meta = {
|
|
title: 'Components/Features/Education/CourseCard',
|
|
component: CourseCard,
|
|
tags: ['autodocs'],
|
|
args: {
|
|
onClick: fn(),
|
|
},
|
|
decorators: [
|
|
(Story) => (
|
|
<div className="w-[300px]">
|
|
<Story />
|
|
</div>
|
|
),
|
|
],
|
|
} satisfies Meta<typeof CourseCard>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Default: Story = {
|
|
args: {
|
|
course: mockCourse,
|
|
},
|
|
};
|
|
|
|
export const InProgress: Story = {
|
|
args: {
|
|
course: { ...mockCourse, progress: 60 },
|
|
showProgress: true,
|
|
},
|
|
};
|
|
|
|
export const Completed: Story = {
|
|
args: {
|
|
course: { ...mockCourse, progress: 100, certificateAvailable: true },
|
|
showProgress: true,
|
|
},
|
|
};
|
|
|
|
export const Beginner: Story = {
|
|
args: {
|
|
course: { ...mockCourse, level: 'Beginner', title: 'Intro into Music' },
|
|
},
|
|
};
|