diff --git a/src/components/Common/Divider/Divider.stories.tsx b/src/components/Common/Divider/Divider.stories.tsx new file mode 100644 index 000000000..4682880c9 --- /dev/null +++ b/src/components/Common/Divider/Divider.stories.tsx @@ -0,0 +1,23 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import Divider from './Divider'; + +const meta: Meta = { + title: 'common/Divider', + component: Divider, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: { + variant: 'default', + }, +}; + +export const Light: Story = { + args: { + variant: 'light', + }, +}; diff --git a/src/components/Common/Divider/Divider.tsx b/src/components/Common/Divider/Divider.tsx new file mode 100644 index 000000000..848e4cf1b --- /dev/null +++ b/src/components/Common/Divider/Divider.tsx @@ -0,0 +1,28 @@ +import cx from 'classnames'; +import type { ComponentPropsWithoutRef } from 'react'; + +import { divider, dividerHeight, dividerWidth } from './divider.css'; + +import { assignInlineVars } from '@vanilla-extract/dynamic'; + +export interface DividerProps extends ComponentPropsWithoutRef<'hr'> { + variant?: 'default' | 'light' | 'navigation'; + width?: string; + height?: string; +} + +const Divider = ({ variant = 'default', width = '100%', height = '1px', ...props }: DividerProps) => { + return ( +
+ ); +}; + +export default Divider; diff --git a/src/components/Common/Divider/divider.css.ts b/src/components/Common/Divider/divider.css.ts new file mode 100644 index 000000000..ab9939054 --- /dev/null +++ b/src/components/Common/Divider/divider.css.ts @@ -0,0 +1,23 @@ +import { vars } from '@/styles/theme.css'; +import { createVar, style } from '@vanilla-extract/css'; +import { recipe } from '@vanilla-extract/recipes'; + +export const dividerWidth = createVar(); +export const dividerHeight = createVar(); + +export const dividerBase = style({ + width: dividerWidth, + height: dividerHeight, + border: 0, +}); + +export const divider = recipe({ + base: dividerBase, + variants: { + variant: { + default: { backgroundColor: vars.colors.border.default }, + light: { backgroundColor: vars.colors.border.light }, + navigation: { backgroundColor: vars.colors.border.navigation }, + }, + }, +}); diff --git a/src/components/Common/ErrorComponent/ErrorComponent.tsx b/src/components/Common/ErrorComponent/ErrorComponent.tsx index ff0027c4b..0c8326ece 100644 --- a/src/components/Common/ErrorComponent/ErrorComponent.tsx +++ b/src/components/Common/ErrorComponent/ErrorComponent.tsx @@ -1,4 +1,5 @@ import { container } from './errorComponent.css'; +import Spacing from '../Spacing/Spacing'; import Text from '../Typography/Text/Text'; import Error from '@/assets/error.png'; @@ -6,13 +7,13 @@ import Error from '@/assets/error.png'; const ErrorComponent = () => { return (
-
+ 404 캐릭터 -
+ 에러가 발생했습니다 -
+
); }; diff --git a/src/components/Common/Spacing/Spacing.stories.tsx b/src/components/Common/Spacing/Spacing.stories.tsx new file mode 100644 index 000000000..3cf539af0 --- /dev/null +++ b/src/components/Common/Spacing/Spacing.stories.tsx @@ -0,0 +1,81 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import type { PropsWithChildren } from 'react'; + +import Spacing from './Spacing'; + +import { vars } from '@/styles/theme.css'; + +const meta: Meta = { + title: 'common/Spacing', + component: Spacing, +}; + +export default meta; +type Story = StoryObj; + +const Container = ({ children, vertical }: PropsWithChildren<{ vertical?: boolean }>) => { + return ( +
+ {children} +
+ ); +}; + +const Box = () => { + return ( +
+ ); +}; + +export const Default: Story = { + render: ({ direction = 'vertical', size }) => ( + + + + + + + + + + ), +}; + +export const Vertical: Story = { + render: ({ size }) => ( + + + + + + + + + + ), +}; + +export const Horizontal: Story = { + render: ({ size }) => ( + + + + + + + + + + ), +}; diff --git a/src/components/Common/Spacing/Spacing.tsx b/src/components/Common/Spacing/Spacing.tsx new file mode 100644 index 000000000..d2bc12d09 --- /dev/null +++ b/src/components/Common/Spacing/Spacing.tsx @@ -0,0 +1,27 @@ +import type { ComponentPropsWithoutRef } from 'react'; + +import { spacing, spacingSize } from './spacing.css'; + +import { assignInlineVars } from '@vanilla-extract/dynamic'; + +type SpacingDirections = 'vertical' | 'horizontal'; + +export interface SpacingProps extends ComponentPropsWithoutRef<'div'> { + direction?: SpacingDirections; + size: number; +} + +const Spacing = ({ direction = 'vertical', size, ...props }: SpacingProps) => { + return ( +