diff --git a/apps/docs/package.json b/apps/docs/package.json index 24c8983..4861c24 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -13,7 +13,7 @@ "chromatic": "npx chromatic --project-token=chpt_98c750b6bad066a" }, "dependencies": { - "@sopt-makers/ui": "^1.0.2" + "@sopt-makers/ui": "1.1.1" }, "devDependencies": { "@storybook/addon-essentials": "^7.6.3", diff --git a/apps/docs/src/stories/SearchField.stories.tsx b/apps/docs/src/stories/SearchField.stories.tsx new file mode 100644 index 0000000..185d9da --- /dev/null +++ b/apps/docs/src/stories/SearchField.stories.tsx @@ -0,0 +1,49 @@ +import { ChangeEvent, useState, type InputHTMLAttributes } from 'react'; +import { StoryObj } from '@storybook/react'; +import { SearchField } from '@sopt-makers/ui'; +import { fn } from '@storybook/test'; + +interface SearchFieldProps extends Omit, 'value'> { + value: string; + onSubmit: () => void; + onReset: () => void; +} + +const useSearchField = (props: SearchFieldProps) => { + const [search, setSearch] = useState(props.value); + + const handleSearchChange = (e: ChangeEvent) => { + setSearch(e.target.value); + } + + const handleSearchReset = () => { + setSearch(''); + } + + return +} + +export default { + title: 'Components/Input/SearchField', + component: useSearchField, + tags: ['autodocs'], + args: { + value: '', + style: { width: '335px' }, + onSubmit: fn(), + }, + argTypes: { + value: { control: false }, + style: { control: false }, + onSubmit: { action: 'onSubmit' } + } +} + +export const SearchFieldStory: StoryObj = { + args: { + placeholder: 'Placeholder...', + readOnly: false, + disabled: false, + style: { width: '335px' }, + }, +}; \ No newline at end of file diff --git a/apps/docs/src/stories/Test.stories.ts b/apps/docs/src/stories/Test.stories.ts deleted file mode 100644 index 82e7bb5..0000000 --- a/apps/docs/src/stories/Test.stories.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/react'; - -import { Test } from "@sopt-makers/ui"; - -const meta = { - title: 'Example/Test', - component: Test, - parameters: { - layout: 'centered', - }, - tags: ['autodocs'], - argTypes: { - color: { - options: ['black', 'red', 'blue'], - control: { type: 'radio' }, - }, - size: { - options: ['normal', 'big'], - control: { type: 'radio' }, - }, - }, -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -export const Primary: Story = { - args: { - text: "Primary", - }, -} - -export const Secondary: Story = { - args: { - text: "Secondary", - }, -} \ No newline at end of file diff --git a/apps/docs/src/stories/TextArea.stories.tsx b/apps/docs/src/stories/TextArea.stories.tsx new file mode 100644 index 0000000..c446cc1 --- /dev/null +++ b/apps/docs/src/stories/TextArea.stories.tsx @@ -0,0 +1,157 @@ +import { ChangeEvent, useState, type TextareaHTMLAttributes } from 'react'; +import { StoryObj } from '@storybook/react'; +import { TextArea } from '@sopt-makers/ui'; +import { fn } from '@storybook/test'; + +interface TextAreaProps extends Omit, 'value'> { + labelText?: string; + descriptionText?: string; + errorMessage?: string; + value: string; + maxLength: number; + height?: string; + isError?: boolean; + onSubmit: () => void; +} + +const useTextArea = (props: TextAreaProps) => { + const [text, setText] = useState(props.value); + + const handleTextChange = (e: ChangeEvent) => { + setText(e.target.value); + } + + return