Skip to content

Commit eae4fa0

Browse files
committed
[style]TextButton컴포넌트
1 parent 95809e8 commit eae4fa0

File tree

3 files changed

+51
-10
lines changed

3 files changed

+51
-10
lines changed

src/app/design-system/page.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Button from '@/shared/components/button/Button';
2-
2+
import TextButton from '@/shared/components/button/TextButton';
33

44
function Page() {
55
return (
@@ -36,11 +36,15 @@ function Page() {
3636

3737
<div className="space-y-2">
3838
<h3 className="text-xl font-medium border-b pb-1">Button</h3>
39-
<Button type='button'>버튼</Button>
40-
<Button variant="purple" type='button'>
39+
<Button type="button">버튼</Button>
40+
<Button variant="purple" type="button">
4141
Button
4242
</Button>
43-
<Button type='button' disabled={true} variant="disable">button</Button>
43+
<Button type="button" disabled={true} variant="disable">
44+
button
45+
</Button>
46+
<TextButton>텍스트 버튼</TextButton>
47+
<TextButton size="sm">텍스트 버튼</TextButton>
4448
</div>
4549
</div>
4650

src/shared/components/button/Button.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
1414
}
1515

1616
const SIZE = {
17-
default:
18-
'py-1 px-2 h-10 rounded-lg text-base font-bold min-w-25 flex-center',
19-
sm:'py-1 px-2 rounded-lg text-base font-bold min-w-20 flex-center',
17+
default: 'py-1 px-2 h-10 rounded-lg text-base font-bold min-w-25 flex-center',
18+
sm: 'py-1 px-2 rounded-lg text-base font-bold min-w-20 flex-center',
2019
};
2120

2221
const VARIANT = {
@@ -27,15 +26,22 @@ const VARIANT = {
2726

2827
function Button({
2928
size = 'default',
30-
type = 'submit',
29+
type = 'button',
3130
disabled = false,
3231
variant = 'default',
3332
children,
3433
className,
3534
ref,
36-
...rest }: Props) {
35+
...rest
36+
}: Props) {
3737
return (
38-
<button className={`${SIZE[size]} ${VARIANT[variant]} ${className}`} type={type} disabled={disabled} {...rest} ref={ref}>
38+
<button
39+
className={`${SIZE[size]} ${VARIANT[variant]} ${className}`}
40+
type={type}
41+
disabled={disabled}
42+
{...rest}
43+
ref={ref}
44+
>
3945
{children}
4046
</button>
4147
);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Ref } from 'react';
2+
3+
interface Props {
4+
size?: 'default' | 'sm';
5+
type?: 'button' | 'submit';
6+
ref?: Ref<HTMLButtonElement | null>;
7+
children: React.ReactNode;
8+
className?: string;
9+
}
10+
11+
const SIZE = {
12+
default: 'text-base flex flex-col justfy-center',
13+
sm: 'text-sm flex flex-col justfy-center',
14+
};
15+
16+
function TextButton({
17+
type = 'button',
18+
children,
19+
className,
20+
ref,
21+
size = 'default',
22+
...rest
23+
}: Props) {
24+
return (
25+
<button className={`${SIZE[size]} ${className}`} type={type} ref={ref} {...rest}>
26+
{children}
27+
<div className="h-[1px] w-100% bg-white"></div>
28+
</button>
29+
);
30+
}
31+
export default TextButton;

0 commit comments

Comments
 (0)