File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
src/shared/components/v2/button Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change 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' ;
25import * as styles from '../icon/Icon.css' ;
36
47export 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
2022const 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} ;
You can’t perform that action at this time.
0 commit comments