Skip to content

Commit 8615420

Browse files
committed
chore: React.ComponentProps 사용하도록 변경
1 parent a5a2bb4 commit 8615420

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/shared/components/v2/button/IconButton.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
1-
import IconsResponsive, { type IconName, type IconSize } from '../icon/Icon';
1+
import clsx from 'clsx';
2+
3+
import { type IconName, type IconSize } from '../icon/Icon';
4+
import Icon from '../icon/Icon';
25
import * as styles from '../icon/Icon.css';
36

47
export type IconButtonSize = 'S' | 'M' | 'L' | 'XL';
58

6-
const BTN_ICON_SIZE: Record<IconButtonSize, IconSize> = {
9+
const ICON_BUTTON_SIZE: Record<IconButtonSize, IconSize> = {
710
S: '20',
811
M: '24',
912
L: '32',
1013
XL: '40',
1114
} as const;
1215

13-
export interface IconButtonProps {
16+
export interface IconButtonProps
17+
extends Omit<React.ComponentProps<'button'>, 'children'> {
1418
name: IconName;
1519
size?: IconButtonSize;
16-
disabled?: boolean;
17-
onClick?: () => void;
1820
}
1921

2022
const IconButton = ({
2123
name,
2224
size = 'S',
25+
type = 'button',
26+
className,
2327
disabled = false,
24-
onClick,
28+
...props
2529
}: IconButtonProps) => {
2630
return (
2731
<button
28-
type="button"
29-
className={styles.iconButton({
30-
size,
31-
disabled,
32-
})}
32+
type={type}
33+
className={clsx(styles.iconButton({ size, disabled }), className)}
3334
disabled={disabled}
34-
onClick={onClick}
35+
{...props}
3536
>
36-
<IconsResponsive size={BTN_ICON_SIZE[size]} name={name} />
37+
<Icon size={ICON_BUTTON_SIZE[size]} name={name} />
3738
</button>
3839
);
3940
};

0 commit comments

Comments
 (0)