diff --git a/public/leftarrow.svg b/public/left-arrow.svg similarity index 80% rename from public/leftarrow.svg rename to public/left-arrow.svg index 4d7cd36..1a5799e 100644 --- a/public/leftarrow.svg +++ b/public/left-arrow.svg @@ -1,3 +1,3 @@ - + diff --git a/public/right-arrow.svg b/public/right-arrow.svg new file mode 100644 index 0000000..1389029 --- /dev/null +++ b/public/right-arrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/rightarrow.svg b/public/rightarrow.svg deleted file mode 100644 index dee26e6..0000000 --- a/public/rightarrow.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/app/page.tsx b/src/app/page.tsx index d67fc2c..9e5158e 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -25,16 +25,17 @@ export default function Home() { - + + {/* 공통 버튼 */} - + + {/* 페이지네이션 */} - ) } diff --git a/src/components/common/button/Button.tsx b/src/components/common/button/Button.tsx index eb67721..6556d77 100644 --- a/src/components/common/button/Button.tsx +++ b/src/components/common/button/Button.tsx @@ -52,4 +52,4 @@ const Button = ({ ) } -export { Button } +export default Button diff --git a/src/components/common/button/TextButton.tsx b/src/components/common/button/TextButton.tsx new file mode 100644 index 0000000..00da297 --- /dev/null +++ b/src/components/common/button/TextButton.tsx @@ -0,0 +1,65 @@ +import * as React from 'react' +import { Slot } from '@radix-ui/react-slot' +import { cva, type VariantProps } from 'class-variance-authority' +import { cn } from '@/lib/utils' +import LeftArrowIcon from '/public/left-arrow.svg' +import RightArrowIcon from '/public/right-arrow.svg' + +// 아이콘 위치 타입 정의 +type IconPosition = 'left' | 'right' + +type TextButtonProps = React.ComponentProps<'button'> & + VariantProps & { + iconPosition?: IconPosition + asChild?: boolean + } + +const textButtonVariants = cva( + 'inline-flex items-center justify-center whitespace-nowrap disabled:pointer-events-none outline-none cursor-pointer', + { + variants: { + size: { + xs: 'typo-caption2 gap-0.5', + sm: 'typo-caption1 gap-1', + md: 'typo-body3 gap-1', + lg: 'typo-body2 gap-2', + xl: 'typo-h3 gap-2', + }, + }, + defaultVariants: { + size: 'md', + }, + }, +) + +// 버튼 size prop에 따른 아이콘 크기 Mapping +const IconSizeMap = { + xs: 'w-2.5 h-2.5', + sm: 'w-3 h-3', + md: 'w-4.5 h-4.5', + lg: 'w-4.5 h-4.5', + xl: 'w-6 h-6', +} + +const TextButton = ({ + className, + size = 'md', + iconPosition, + asChild = false, + children, + ...props +}: TextButtonProps) => { + const Comp = asChild ? Slot : 'button' + + return ( + + {iconPosition === 'left' && } + {children} + {iconPosition === 'right' && ( + + )} + + ) +} + +export default TextButton diff --git a/src/components/design-system/ButtonTest.tsx b/src/components/design-system/ButtonTest.tsx index 690accf..ea622ad 100644 --- a/src/components/design-system/ButtonTest.tsx +++ b/src/components/design-system/ButtonTest.tsx @@ -1,17 +1,21 @@ import React from 'react' -import { Button } from '../common/Button/Button' +import Button from '../common/Button/Button' +import TextButton from '../common/Button/TextButton' const ButtonTest = () => { - const variants = ['primary', 'secondary', 'tertiary', 'outline'] - const sizes = ['lg', 'md', 'sm'] + const defaultButtonVars = ['primary', 'secondary', 'tertiary', 'outline'] + const defaultButtonSizes = ['lg', 'md', 'sm'] + + const textButtonSizes = ['xl', 'lg', 'md', 'sm', 'xs'] + return (

기본 버튼

- {variants.map((variant) => ( + {defaultButtonVars.map((variant) => (

{variant}

- {sizes.map((s) => ( + {defaultButtonSizes.map((s) => ( <>
))} + +

텍스트 버튼

+ {textButtonSizes.map((size) => ( +
+

{size}

+
+ 텍스트버튼(아이콘x) + + 텍스트버튼(좌측아이콘) + + + 텍스트버튼(우측아이콘) + +
+
+ ))} ) } diff --git a/src/components/ui/pagination-container.tsx b/src/components/ui/pagination-container.tsx index 73457e5..99d2802 100644 --- a/src/components/ui/pagination-container.tsx +++ b/src/components/ui/pagination-container.tsx @@ -1,6 +1,6 @@ import * as React from 'react' -import RightArrowIcon from '../../../public/rightarrow.svg' -import LeftArrowIcon from '../../../public/leftarrow.svg' +import LeftArrowIcon from '/public/left-arrow.svg' +import RightArrowIcon from '/public/right-arrow.svg' import { cn } from '@/lib/utils' import { Button, buttonVariants } from '@/components/ui/button' diff --git a/src/styles/globals.css b/src/styles/globals.css index cf716e2..d0cec73 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -157,7 +157,7 @@ } ::-webkit-scrollbar-thumb { - @apply rounded-full bg-border-alter; + @apply rounded-full bg-alter-line; } }