Skip to content

Commit 4b2efe5

Browse files
committed
feat : 버튼 컴포넌트에 클릭 핸들러 추가
1 parent 91131bc commit 4b2efe5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

client/src/components/common/Button/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface ButtonProps {
1010
className?: string;
1111
isDisable?: boolean;
1212
color?: string;
13+
onClick?: () => void;
1314
}
1415

1516
function Button({
@@ -18,14 +19,21 @@ function Button({
1819
className,
1920
isDisable = false,
2021
color,
22+
onClick,
2123
}: ButtonProps) {
24+
const onClickBtn = () => {
25+
if (onClick) onClick();
26+
};
27+
2228
return (
2329
<div
2430
className={cx(style.button, className, { disable: isDisable })}
2531
style={{ backgroundColor: color }}
2632
>
2733
{icon}
28-
<button disabled={isDisable}>{text}</button>
34+
<button disabled={isDisable} onClick={onClickBtn}>
35+
{text}
36+
</button>
2937
</div>
3038
);
3139
}

0 commit comments

Comments
 (0)