diff --git a/src/components/Common/Typography/Heading/Heading.stories.tsx b/src/components/Common/Typography/Heading/Heading.stories.tsx new file mode 100644 index 00000000..99abda5c --- /dev/null +++ b/src/components/Common/Typography/Heading/Heading.stories.tsx @@ -0,0 +1,20 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import Heading from './Heading'; + +const meta: Meta = { + title: 'common/Heading', + component: Heading, + args: { + children: '안녕하세요 펀잇입니다.', + color: 'default', + size: 'body', + weight: 'regular', + as: 'h1', + }, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = {}; diff --git a/src/components/Common/Typography/Heading/Heading.tsx b/src/components/Common/Typography/Heading/Heading.tsx new file mode 100644 index 00000000..88dd6490 --- /dev/null +++ b/src/components/Common/Typography/Heading/Heading.tsx @@ -0,0 +1,28 @@ +import cx from 'classnames'; +import type { ElementType } from 'react'; + +import { typography } from '../typography.css'; +import type { OverridableComponentPropsWithoutRef, TypographyVariants } from '../typography.types'; + +type HeadingElement = Extract; +type HeadingProps = OverridableComponentPropsWithoutRef; + +const Heading = ({ + children, + size = 'body', + weight = 'regular', + color = 'default', + as, + className, + ...props +}: HeadingProps) => { + const Component = as || 'h1'; + + return ( + + {children} + + ); +}; + +export default Heading;