Skip to content

Commit

Permalink
feat: Storybook 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
seongjinme committed Aug 2, 2024
1 parent f89384b commit dc4f903
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions frontend/src/components/common/TextEditor/TextEditor.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import type { Meta, StoryObj } from '@storybook/react';
import { useState } from 'react';
import TextEditor from '.';

const meta = {
title: 'Common/Input/TextEditor',
component: TextEditor,
parameters: {
layout: 'centered',
docs: {
description: {
component: 'ReactQuill 에디터를 wrapping한 TextEditor 컴포넌트입니다.',
},
},
},

tags: ['autodocs'],

argTypes: {
width: { control: 'text' },
height: { control: 'text' },
placeholder: { control: 'text' },
value: { control: false },
onChange: { control: false },
onBlur: { action: 'blurred', control: false },
},

decorators: [
(Story) => {
const [value, setValue] = useState('');
const handleChange = (content: string) => setValue(content);

return (
<div style={{ width: '60rem', height: '40rem' }}>
<Story
value={value}
onChange={handleChange}
/>
</div>
);
},
],
} satisfies Meta<typeof TextEditor>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
value: '',
placeholder: '내용을 입력하세요...',
onChange: () => {},
},
};

0 comments on commit dc4f903

Please sign in to comment.