diff --git a/apps/wow-docs/app/page.tsx b/apps/wow-docs/app/page.tsx index 282a6da3..b3efe34c 100644 --- a/apps/wow-docs/app/page.tsx +++ b/apps/wow-docs/app/page.tsx @@ -1,5 +1,6 @@ import Checkbox from "wowds-ui/Checkbox"; import Chip from "wowds-ui/Chip"; +import Divider from "wowds-ui/Divider"; import DropDown from "wowds-ui/DropDown"; import DropDownOption from "wowds-ui/DropDownOption"; import MultiGroup from "wowds-ui/MultiGroup"; @@ -12,6 +13,8 @@ const Home = () => { <> + + diff --git a/packages/wow-ui/package.json b/packages/wow-ui/package.json index cbafd487..b7dc2770 100644 --- a/packages/wow-ui/package.json +++ b/packages/wow-ui/package.json @@ -65,6 +65,11 @@ "require": "./dist/DropDown.cjs", "import": "./dist/DropDown.js" }, + "./Divider": { + "types": "./dist/components/Divider/index.d.ts", + "require": "./dist/Divider.cjs", + "import": "./dist/Divider.js" + }, "./Chip": { "types": "./dist/components/Chip/index.d.ts", "require": "./dist/Chip.cjs", diff --git a/packages/wow-ui/rollup.config.js b/packages/wow-ui/rollup.config.js index 05b7b61b..80d15fc0 100644 --- a/packages/wow-ui/rollup.config.js +++ b/packages/wow-ui/rollup.config.js @@ -29,6 +29,7 @@ export default { MultiGroup: "./src/components/MultiGroup", DropDownOption: "./src/components/DropDown/DropDownOption", DropDown: "./src/components/DropDown", + Divider: "./src/components/Divider", Chip: "./src/components/Chip", Checkbox: "./src/components/Checkbox", Button: "./src/components/Button", diff --git a/packages/wow-ui/src/components/Divider/Divider.stories.ts b/packages/wow-ui/src/components/Divider/Divider.stories.ts new file mode 100644 index 00000000..e9f6fe4a --- /dev/null +++ b/packages/wow-ui/src/components/Divider/Divider.stories.ts @@ -0,0 +1,54 @@ +import type { Meta, StoryObj } from "@storybook/react"; + +import Divider from "@/components/Divider"; + +const meta = { + title: "UI/Divider", + component: Divider, + tags: ["autodocs"], + parameters: { + componentSubtitle: "디바이더 컴포넌트", + }, + argTypes: { + type: { + description: "라이트모드, 다크모드에 따라 디바이더의 색상이 달라집니다.", + table: { + type: { summary: '"light" | "dark"' }, + defaultValue: { summary: "light" }, + }, + control: { + type: "radio", + options: ["light", "dark"], + }, + }, + style: { + description: "디바이더의 커스텀 스타일을 설정할 수 있습니다.", + table: { + type: { summary: "CSSProperties" }, + defaultValue: { summary: "{}" }, + }, + control: false, + }, + className: { + description: "디바이더에 전달하는 커스텀 클래스를 설정합니다.", + table: { + type: { summary: "string" }, + }, + control: false, + }, + }, +} satisfies Meta; + +export default meta; + +type Story = StoryObj; + +export const Light: Story = { + args: {}, +}; + +export const Dark: Story = { + args: { + type: "dark", + }, +}; diff --git a/packages/wow-ui/src/components/Divider/index.tsx b/packages/wow-ui/src/components/Divider/index.tsx new file mode 100644 index 00000000..0ee7caed --- /dev/null +++ b/packages/wow-ui/src/components/Divider/index.tsx @@ -0,0 +1,51 @@ +import { cva } from "@styled-system/css"; +import { styled } from "@styled-system/jsx"; +import type { CSSProperties } from "react"; + +export interface DividerProps { + type?: "light" | "dark"; + style?: CSSProperties; + className?: string; +} + +/** + * @description 디바이더 컴포넌트의 속성을 정의합니다. + * + * @param {"light" | "dark"} [type] 디바이더의 테마 모드를 설정합니다. + * @param {CSSProperties} [style] 디바이더의 커스텀 스타일을 설정합니다. + * @param {string} [className] 디바이더에 전달하는 커스텀 클래스를 설정합니다. + * @param {ComponentPropsWithoutRef} rest 렌더링된 요소 또는 컴포넌트에 전달할 추가 props. + */ + +const Divider = ({ type = "light", ...rest }: DividerProps) => { + return ( + + ); +}; + +Divider.displayName = "Divider"; + +export default Divider; + +const dividerStyle = cva({ + base: { + width: "100%", + height: "0.075rem", + borderRadius: "100%", + }, + variants: { + type: { + light: { + bgColor: "lightDisabled", + }, + dark: { + bgColor: "darkDisabled", + }, + }, + }, +});