You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
898 B
35 lines
898 B
import type { Post } from 'contentlayer/generated';
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
|
|
import { useSearchStore } from '@/stores/search-store';
|
|
import { Search } from '@/components/search';
|
|
|
|
const posts = Array.from({ length: 50 }, (_, index) => ({
|
|
title: `Example Post ${index + 1}`,
|
|
excerpt: 'This is an example post.',
|
|
date: '2022-01-01',
|
|
tags: ['example', 'post', 'test', 'storybook', `tag${(index + 1) % 10}`],
|
|
url: `/posts/post-${index + 1}`,
|
|
slug: `posts/post-${index + 1}`,
|
|
body: {
|
|
raw: `Post ${index + 1} body`,
|
|
},
|
|
})) as Post[];
|
|
|
|
const meta: Meta<typeof Search> = {
|
|
title: 'Search',
|
|
component: Search,
|
|
decorators: [
|
|
(Story) => {
|
|
useSearchStore((state) => state.toggleSearch)();
|
|
return <Story />;
|
|
},
|
|
],
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof Search>;
|
|
|
|
export const Normal: Story = {
|
|
args: { posts },
|
|
};
|
|
|