Skip to content

Commit b3adf77

Browse files
committed
feat: add 'filled' variant to Button component and enhance styles for hover and focus states
1 parent f9756a7 commit b3adf77

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

src/components/button/Button.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const meta = {
1818
default: false
1919
},
2020
variant: {
21-
options: ['none', 'normal', 'outlined'],
21+
options: ['none', 'normal', 'outlined', 'filled'],
2222
control: {type: 'radio'},
2323
},
2424
color: {table: {disable: true}}

src/components/button/Button.style.scss

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,45 @@
1919

2020
@each $name, $color in variables.$colors {
2121
.button--#{$name} {
22-
@include box.box($color, variables.$white, variables.$white);
23-
@include box.boxHover($color, variables.$white, variables.$white);
24-
@include box.boxActive($color, variables.$white, variables.$white);
22+
@include box.box($color, variables.$white, $color);
23+
@include box.boxHover($color, variables.$white, $color);
24+
@include box.boxActive($color, variables.$white, $color);
2525

2626
&.button--outlined {
2727
background: transparent;
28-
//@include helpers.glassBox($color, variables.$white, $color);
28+
29+
&:hover {
30+
@if ($color == variables.$primary) {
31+
border-color: rgba(variables.$secondary, 0.15);
32+
} @else {
33+
border-color: rgba($color, .15);
34+
}
35+
}
36+
37+
&:active, &:focus, &[aria-selected=true] {
38+
@if ($color == variables.$primary) {
39+
border-color: rgba(variables.$secondary, 0.2);
40+
} @else {
41+
border-color: rgba($color, .2);
42+
}
43+
}
2944
}
3045

3146
&.button--none {
3247
background: transparent;
33-
border: none;
34-
//@include helpers.glassBoxWithoutShadowAndBorder($color, variables.$white, $color);
48+
border-color: transparent;
49+
50+
&:hover {
51+
background: helpers.backgroundColor($color, 1.5);
52+
}
53+
54+
&:active, &:focus, &[aria-selected=true] {
55+
background: helpers.backgroundColor($color, 2);
56+
}
57+
}
58+
59+
&.button--filled {
60+
border-color: transparent;
3561
}
3662
}
3763
}

src/components/button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface ButtonProps extends Code0Component<HTMLButtonElement> {
77
//defaults to primary
88
color?: Color,
99
//default to normal
10-
variant?: "none" | "normal" | "outlined",
10+
variant?: "none" | "normal" | "outlined" | "filled",
1111
//defaults to false
1212
active?: boolean
1313
//defaults to false

0 commit comments

Comments
 (0)