43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react';
|
|
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
import { UserProfilePage } from './UserProfilePage';
|
|
import { UserProfilePageSkeleton } from './user-profile-page';
|
|
|
|
const meta: Meta<typeof UserProfilePage> = {
|
|
title: 'App/Pages/Profile/UserProfilePage',
|
|
component: UserProfilePage,
|
|
parameters: { layout: 'fullscreen' },
|
|
tags: ['autodocs'],
|
|
decorators: [
|
|
(Story, context) => {
|
|
const initialEntries = context.parameters.initialEntries ?? ['/u/demo'];
|
|
return (
|
|
<div className="bg-background min-h-screen">
|
|
<MemoryRouter initialEntries={initialEntries}>
|
|
<Routes>
|
|
<Route path="/u/:username" element={<Story />} />
|
|
</Routes>
|
|
</MemoryRouter>
|
|
</div>
|
|
);
|
|
},
|
|
],
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Default: Story = {
|
|
name: 'Par défaut',
|
|
parameters: { initialEntries: ['/u/demo'] },
|
|
};
|
|
|
|
export const Loading: Story = {
|
|
name: 'Chargement',
|
|
render: () => <UserProfilePageSkeleton />,
|
|
};
|
|
|
|
export const NotFound: Story = {
|
|
name: 'Non trouvé',
|
|
parameters: { initialEntries: ['/u/notfound'] },
|
|
};
|