49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
import { ProfileError } from '@/components/profile/profile.error';
|
|
import { ProfileSkeleton } from '@/components/profile/profile.skeleton';
|
|
import { ProfileView } from '@/components/profile/profile.view';
|
|
import { user } from '../exampleUser';
|
|
|
|
const queryClient = new QueryClient();
|
|
|
|
const meta = {
|
|
title: 'Profile/View',
|
|
component: ProfileView,
|
|
decorators: [
|
|
Story => (
|
|
<QueryClientProvider client={queryClient}>
|
|
<Story />
|
|
</QueryClientProvider>
|
|
),
|
|
],
|
|
} satisfies Meta<typeof ProfileView>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Primary: Story = {
|
|
args: {
|
|
user,
|
|
onSaveBio: async () => Promise.resolve(),
|
|
},
|
|
};
|
|
|
|
export const Loading: Story = {
|
|
render: () => <ProfileSkeleton />,
|
|
args: {
|
|
user: {},
|
|
onSaveBio: async () => Promise.resolve(),
|
|
},
|
|
};
|
|
|
|
export const Error: Story = {
|
|
render: () => <ProfileError reason="用户个人资料未公开" />,
|
|
args: {
|
|
user: {
|
|
allow_public: false,
|
|
},
|
|
onSaveBio: async () => Promise.resolve(),
|
|
},
|
|
};
|