@@ -5,23 +5,35 @@ import Link, { LinkProps } from './uss-router/Link';
55import styles from './ButtonSet.module.css' ;
66
77interface ButtonSetProps {
8+ className ?: string ;
89 children : React . ReactNode ;
910}
1011
11- export const ButtonSet : React . FC < ButtonSetProps > = ( { children } ) => (
12- < div className = { styles . set } > { children } </ div >
12+ export const ButtonSet : React . FC < ButtonSetProps > = ( { className = '' , children } ) => (
13+ < div className = { ` ${ styles . set } ${ className } ` } > { children } </ div >
1314) ;
1415
1516type HTMLButton = JSX . IntrinsicElements [ 'button' ] ;
1617
1718interface ButtonProps extends HTMLButton {
1819 isPrimary ?: boolean ;
20+ isSmall ?: boolean ;
1921 iconLeft ?: React . FC ;
2022 iconRight ?: React . FC ;
2123}
2224
2325export const Button = React . forwardRef < HTMLButtonElement , ButtonProps > (
24- ( { isPrimary = false , iconLeft : IconLeft , iconRight : IconRight , children, ...props } , ref ) => {
26+ (
27+ {
28+ isPrimary = false ,
29+ isSmall = false ,
30+ iconLeft : IconLeft ,
31+ iconRight : IconRight ,
32+ children,
33+ ...props
34+ } ,
35+ ref ,
36+ ) => {
2537 const iconLeft = IconLeft && (
2638 < span className = { styles . iconLeft } >
2739 < IconLeft />
@@ -33,9 +45,10 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
3345 </ span >
3446 ) ;
3547 const ordinalStyle = isPrimary ? styles . primary : styles . secondary ;
48+ const smallStyle = isSmall ? styles . small : '' ;
3649
3750 return (
38- < button ref = { ref } className = { ordinalStyle } { ...props } >
51+ < button ref = { ref } className = { ` ${ ordinalStyle } ${ smallStyle } ` } { ...props } >
3952 { iconLeft }
4053 { children }
4154 { iconRight }
@@ -47,12 +60,20 @@ Button.displayName = 'Button';
4760
4861export const Rule : React . FC = ( ) => < span className = { styles . rule } /> ;
4962
50- export const IconButton = React . forwardRef < HTMLButtonElement , HTMLButton > (
51- ( { children, ...props } , ref ) => (
52- < button ref = { ref } className = { styles . icon } { ...props } >
53- { children }
54- </ button >
55- ) ,
63+ interface IconButtonProps extends HTMLButton {
64+ isSmall ?: boolean ;
65+ }
66+
67+ export const IconButton = React . forwardRef < HTMLButtonElement , IconButtonProps > (
68+ ( { isSmall = false , children, ...props } , ref ) => {
69+ const smallStyle = isSmall ? styles . small : '' ;
70+
71+ return (
72+ < button ref = { ref } className = { `${ styles . icon } ${ smallStyle } ` } { ...props } >
73+ { children }
74+ </ button >
75+ ) ;
76+ } ,
5677) ;
5778IconButton . displayName = 'IconButton' ;
5879
0 commit comments