File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed
apps/site/components/Common/Button Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 17
17
@apply cursor-not-allowed;
18
18
}
19
19
20
+ & .small {
21
+ @apply px-3
22
+ py-2
23
+ text-sm;
24
+ }
25
+
20
26
& .neutral {
21
27
@apply rounded
22
28
bg-neutral-900
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export const Neutral: Story = {
11
11
kind : 'neutral' ,
12
12
children : 'Download Node (LTS)' ,
13
13
disabled : false ,
14
+ size : 'default' ,
14
15
} ,
15
16
} ;
16
17
@@ -19,6 +20,7 @@ export const Primary: Story = {
19
20
kind : 'primary' ,
20
21
children : 'Download Node (LTS)' ,
21
22
disabled : false ,
23
+ size : 'default' ,
22
24
} ,
23
25
} ;
24
26
@@ -27,6 +29,7 @@ export const Secondary: Story = {
27
29
kind : 'secondary' ,
28
30
children : 'Download Node (LTS)' ,
29
31
disabled : false ,
32
+ size : 'default' ,
30
33
} ,
31
34
} ;
32
35
@@ -35,6 +38,7 @@ export const Special: Story = {
35
38
kind : 'special' ,
36
39
children : 'Download Node (LTS)' ,
37
40
disabled : false ,
41
+ size : 'default' ,
38
42
} ,
39
43
} ;
40
44
@@ -48,7 +52,16 @@ export const WithIcon: Story = {
48
52
</ >
49
53
) ,
50
54
disabled : false ,
55
+ size : 'default' ,
51
56
} ,
52
57
} ;
53
58
54
- export default { component : Button } as Meta ;
59
+ export default {
60
+ component : Button ,
61
+ argTypes : {
62
+ size : {
63
+ options : [ 'default' , 'small' ] ,
64
+ control : { type : 'radio' } ,
65
+ } ,
66
+ } ,
67
+ } as Meta ;
Original file line number Diff line number Diff line change @@ -14,11 +14,13 @@ import styles from './index.module.css';
14
14
15
15
type ButtonProps = AnchorHTMLAttributes < HTMLAnchorElement > & {
16
16
kind ?: 'neutral' | 'primary' | 'secondary' | 'special' ;
17
+ size ?: 'default' | 'small' ;
17
18
disabled ?: boolean ;
18
19
} ;
19
20
20
21
const Button : FC < ButtonProps > = ( {
21
22
kind = 'primary' ,
23
+ size = 'default' ,
22
24
disabled = false ,
23
25
href = undefined ,
24
26
children,
@@ -56,7 +58,12 @@ const Button: FC<ButtonProps> = ({
56
58
role = "button"
57
59
href = { disabled ? undefined : href }
58
60
aria-disabled = { disabled }
59
- className = { classNames ( styles . button , styles [ kind ] , className ) }
61
+ className = { classNames (
62
+ styles . button ,
63
+ styles [ kind ] ,
64
+ styles [ size ] ,
65
+ className
66
+ ) }
60
67
tabIndex = { disabled ? - 1 : 0 } // Ensure focusable if not disabled
61
68
onClick = { onClickHandler }
62
69
onKeyDown = { onKeyDownHandler }
You can’t perform that action at this time.
0 commit comments