Skip to content

Commit ea60ab3

Browse files
authored
fix: button compound variants
1 parent 916f30d commit ea60ab3

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

components/Button/Button.themes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export namespace Theme {
2525

2626
export const getLight: Factory = (primaryColor) => ({
2727
buttonPrimaryBg: '$primary',
28+
buttonPrimaryFocusBg: tinycolor(primaryColor.value).lighten(10).toHslString(),
2829
buttonPrimaryText: 'white',
2930
buttonPrimaryFocusBorder: primaryColor.helpers.pickScale(6, { alpha: true }),
3031
buttonPrimaryGhostHoverText: '$deepBlue9',
@@ -42,6 +43,7 @@ export namespace Theme {
4243

4344
export const getDark: Factory = (primaryColor) => ({
4445
buttonPrimaryBg: '$primary',
46+
buttonPrimaryFocusBg: tinycolor(primaryColor.value).lighten(10).toHslString(),
4547
buttonPrimaryText: '$deepBlue2',
4648
buttonPrimaryFocusBorder: primaryColor.helpers.pickScale(12, { alpha: true }),
4749
buttonPrimaryGhostHoverText: tinycolor(primaryColor.value).lighten(10).toHslString(),

components/Button/Button.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,15 @@ export const StyledButton = styled('button', BUTTON_BASE_STYLES, {
216216
},
217217
},
218218
},
219+
{
220+
variant: 'primary',
221+
state: 'active',
222+
css: {
223+
backgroundColor: '$buttonPrimaryFocusBg',
224+
color: '$buttonPrimaryText',
225+
boxShadow: 'inset 0 0 0 2px white',
226+
},
227+
},
219228
{
220229
variant: 'secondary',
221230
state: 'waiting',
@@ -226,10 +235,10 @@ export const StyledButton = styled('button', BUTTON_BASE_STYLES, {
226235
},
227236
{
228237
variant: 'secondary',
229-
state: 'active',
238+
ghost: true,
230239
css: {
231-
backgroundColor: '$buttonPrimaryBg',
232-
color: '$buttonPrimaryText',
240+
backgroundColor: 'transparent',
241+
color: '$buttonSecondaryText',
233242
},
234243
},
235244
{
@@ -240,6 +249,15 @@ export const StyledButton = styled('button', BUTTON_BASE_STYLES, {
240249
color: 'transparent',
241250
},
242251
},
252+
{
253+
variant: 'red',
254+
state: 'active',
255+
css: {
256+
backgroundColor: '$buttonRedFocusBg',
257+
color: '$buttonRedText',
258+
boxShadow: 'inset 0 0 0 2px white',
259+
},
260+
},
243261
{
244262
variant: 'red',
245263
ghost: 'true',
@@ -291,7 +309,7 @@ export const Button = React.forwardRef<React.ElementRef<typeof StyledButton>, Bu
291309
{children}
292310
</Component>
293311
);
294-
}
312+
},
295313
);
296314

297315
const BaseButton = (props: ButtonProps): JSX.Element => <Button {...props} />;

vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ import react from '@vitejs/plugin-react';
22
import { defineConfig } from 'vite';
33

44
export default defineConfig({
5+
optimizeDeps: {
6+
exclude: ['storybook'],
7+
},
58
plugins: [react()],
69
});

0 commit comments

Comments
 (0)