@@ -5,23 +5,35 @@ import Link, { LinkProps } from './uss-router/Link';
5
5
import styles from './ButtonSet.module.css' ;
6
6
7
7
interface ButtonSetProps {
8
+ className ?: string ;
8
9
children : React . ReactNode ;
9
10
}
10
11
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 >
13
14
) ;
14
15
15
16
type HTMLButton = JSX . IntrinsicElements [ 'button' ] ;
16
17
17
18
interface ButtonProps extends HTMLButton {
18
19
isPrimary ?: boolean ;
20
+ isSmall ?: boolean ;
19
21
iconLeft ?: React . FC ;
20
22
iconRight ?: React . FC ;
21
23
}
22
24
23
25
export 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
+ ) => {
25
37
const iconLeft = IconLeft && (
26
38
< span className = { styles . iconLeft } >
27
39
< IconLeft />
@@ -33,9 +45,10 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
33
45
</ span >
34
46
) ;
35
47
const ordinalStyle = isPrimary ? styles . primary : styles . secondary ;
48
+ const smallStyle = isSmall ? styles . small : '' ;
36
49
37
50
return (
38
- < button ref = { ref } className = { ordinalStyle } { ...props } >
51
+ < button ref = { ref } className = { ` ${ ordinalStyle } ${ smallStyle } ` } { ...props } >
39
52
{ iconLeft }
40
53
{ children }
41
54
{ iconRight }
@@ -47,12 +60,20 @@ Button.displayName = 'Button';
47
60
48
61
export const Rule : React . FC = ( ) => < span className = { styles . rule } /> ;
49
62
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
+ } ,
56
77
) ;
57
78
IconButton . displayName = 'IconButton' ;
58
79
0 commit comments