diff --git a/.storybook/main.ts b/.storybook/main.ts index fb59deba..a7b203ba 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,4 +1,5 @@ import type { StorybookConfig } from '@storybook/nextjs'; + const config: StorybookConfig = { stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'], @@ -9,5 +10,34 @@ const config: StorybookConfig = { docs: { autodocs: 'tag', }, + webpackFinal(config) { + const imageRule = config.module!.rules!.find((rule) => { + if (rule && typeof rule !== 'string' && rule.test instanceof RegExp) { + return rule.test.test('.svg') + } + }) + if (imageRule && typeof imageRule !== 'string') { + imageRule.exclude = /\.svg$/ + } + + config.module!.rules!.push({ + test: /\.svg$/, + oneOf: [ + { + resourceQuery: /rect/, + use: { + loader: '@svgr/webpack', + options: { + svgo: false, + }, + }, + }, + { + use: '@svgr/webpack', + }, + ], + }) + return config; + }, }; export default config; diff --git a/src/components/feed/FeedPostViewer/FeedPostViewer.stories.ts b/src/components/feed/FeedPostViewer/FeedPostViewer.stories.ts new file mode 100644 index 00000000..1d3cb4a1 --- /dev/null +++ b/src/components/feed/FeedPostViewer/FeedPostViewer.stories.ts @@ -0,0 +1,35 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import FeedPostViewer from './FeedPostViewer'; + +// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction +const meta: Meta = { + title: 'FeedPostViewer', + component: FeedPostViewer, + tags: ['autodocs'], +}; + +export default meta; +type Story = StoryObj; + +// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args +export const Default: Story = { + args: { + post: { + id: 1, + title: '하트시그널 시즌 1부터 시즌 4까지 중에 가장 인기가 많았던 출연자는?', + contents: `1번 김현우\n2번 오영주\n3번 임현주\n4번 박지현\n5번 기타`, + updatedDate: '2시간 전', + images: [], + user: { + id: 1, + name: '김지민', + profileImage: null, + }, + viewCount: 1234, + likeCount: 0, + isLiked: false, + }, + Actions: [], + }, +};