Skip to content

Commit 9c6efcb

Browse files
committed
Fix minor bugs
1 parent caec37e commit 9c6efcb

File tree

2 files changed

+170
-63
lines changed

2 files changed

+170
-63
lines changed

design/theme.ts

Lines changed: 167 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,105 @@
11
export type Themes = keyof typeof themes;
22

33
export const breakpoints = {
4-
xs: 0,
5-
sm: 576,
6-
md: 768,
7-
lg: 992,
8-
xl: 1200,
9-
}
4+
/** Phones (portrait) */
5+
initial: 0,
6+
/** Phones (landscape) */
7+
xs: 520,
8+
/** Tablets (portrait) */
9+
sm: 768,
10+
/** Tablets (landscape) */
11+
md: 1024,
12+
/** Laptops */
13+
lg: 1280,
14+
/** Desktops */
15+
xl: 1640,
16+
/** Televisions */
17+
xxl: 1920,
18+
} as const;
1019

11-
export const pallete = {
20+
export const display = {
21+
space1: 4,
22+
space2: 8,
23+
space3: 12,
24+
space4: 16,
25+
space5: 24,
26+
space6: 32,
27+
space7: 40,
28+
space8: 48,
29+
space9: 64,
30+
radius1: 3,
31+
radius2: 4,
32+
radius3: 6,
33+
radius4: 8,
34+
radius5: 12,
35+
radius6: 16,
36+
} as const;
37+
38+
export const typography = {
39+
size1: 12,
40+
size2: 14,
41+
size3: 16,
42+
size4: 18,
43+
size5: 20,
44+
size6: 24,
45+
size7: 28,
46+
size8: 35,
47+
size9: 60,
48+
weightThin: '200',
49+
weightLight: '300',
50+
weightRegular: '400',
51+
weightMedium: '500',
52+
weightSemiBold: '600',
53+
weightBold: '700',
54+
lineHeight1: 16,
55+
lineHeight2: 20,
56+
lineHeight3: 24,
57+
lineHeight4: 26,
58+
lineHeight5: 28,
59+
lineHeight6: 30,
60+
lineHeight7: 36,
61+
lineHeight8: 40,
62+
lineHeight9: 60,
63+
letterSpacing1: 0.04,
64+
letterSpacing2: 0,
65+
letterSpacing3: 0,
66+
letterSpacing4: -0.04,
67+
letterSpacing5: -0.08,
68+
letterSpacing6: -0.1,
69+
letterSpacing7: -0.12,
70+
letterSpacing8: -0.16,
71+
letterSpacing9: -0.4,
72+
} as const;
73+
74+
export const font = {
75+
family: 'Inter',
76+
size: typography.size1,
77+
weight: typography.weightRegular,
78+
spacing: typography.letterSpacing1,
79+
height: typography.lineHeight1,
80+
contentSize: typography.size2,
81+
inputSize: typography.size2,
82+
inputWeight: typography.weightMedium,
83+
inputSpacing: typography.letterSpacing2,
84+
inputHeight: typography.lineHeight2,
85+
contentWeight: typography.weightRegular,
86+
contentSpacing: typography.letterSpacing2,
87+
contentHeight: typography.lineHeight2,
88+
labelSize: typography.size3,
89+
labelWeight: typography.weightMedium,
90+
labelSpacing: typography.letterSpacing3,
91+
labelHeight: typography.lineHeight3,
92+
titleSize: typography.size4,
93+
titleWeight: typography.weightSemiBold,
94+
titleSpacing: typography.letterSpacing4,
95+
titleHeight: typography.lineHeight4,
96+
headerSize: typography.size5,
97+
headerWeight: typography.weightMedium,
98+
headerSpacing: typography.letterSpacing5,
99+
headerHeight: typography.lineHeight5,
100+
} as const;
101+
102+
export const palette = {
12103
white: '#ffffff',
13104
black: '#000000',
14105
slate50: '#f8fafc',
@@ -22,17 +113,17 @@ export const pallete = {
22113
slate800: '#1e293b',
23114
slate900: '#0f172a',
24115
slate950: '#020617',
25-
gray50: '#f9fafb',
26-
gray100: '#f3f4f6',
27-
gray200: '#e5e7eb',
28-
gray300: '#d1d5db',
29-
gray400: '#9ca3af',
30-
gray500: '#6b7280',
31-
gray600: '#4b5563',
32-
gray700: '#374151',
33-
gray800: '#1f2937',
34-
gray900: '#111827',
35-
gray950: '#030712',
116+
grey50: '#f9fafb',
117+
grey100: '#f3f4f6',
118+
grey200: '#e5e7eb',
119+
grey300: '#d1d5db',
120+
grey400: '#9ca3af',
121+
grey500: '#6b7280',
122+
grey600: '#4b5563',
123+
grey700: '#374151',
124+
grey800: '#1f2937',
125+
grey900: '#111827',
126+
grey950: '#030712',
36127
zinc50: '#fafafa',
37128
zinc100: '#f4f4f5',
38129
zinc200: '#e4e4e7',
@@ -253,57 +344,73 @@ export const pallete = {
253344
rose800: '#9f1239',
254345
rose900: '#881337',
255346
rose950: '#4c0519',
256-
}
347+
} as const;
257348

258349
export const themes = {
259350
light: {
260351
colors: {
261-
background: pallete.white,
262-
foreground: pallete.zinc950,
263-
card: pallete.white,
264-
cardForeground: pallete.zinc950,
265-
popover: pallete.white,
266-
popoverForeground: pallete.zinc950,
267-
primary: pallete.zinc900,
268-
primaryForeground: pallete.zinc50,
269-
secondary: pallete.zinc100,
270-
secondaryForeground: pallete.zinc900,
271-
muted: pallete.zinc100,
272-
mutedForeground: pallete.zinc500,
273-
accent: pallete.zinc100,
274-
accentForeground: pallete.zinc900,
275-
destructive: pallete.red500,
276-
destructiveForeground: pallete.zinc50,
277-
border: pallete.zinc200,
278-
input: pallete.zinc200,
279-
ring: pallete.zinc950,
280-
outline: pallete.blue400,
352+
background: palette.white,
353+
foreground: palette.zinc950,
354+
card: palette.white,
355+
cardForeground: palette.zinc950,
356+
popover: palette.white,
357+
popoverForeground: palette.zinc950,
358+
primary: palette.zinc900,
359+
primaryForeground: palette.zinc50,
360+
secondary: palette.zinc100,
361+
secondaryForeground: palette.zinc900,
362+
muted: palette.zinc100,
363+
mutedForeground: palette.zinc500,
364+
accent: palette.zinc100,
365+
accentForeground: palette.zinc900,
366+
info: palette.blue500,
367+
success: palette.green500,
368+
warning: palette.yellow500,
369+
destructive: palette.red500,
370+
destructiveForeground: palette.zinc50,
371+
border: palette.zinc200,
372+
input: palette.zinc200,
373+
ring: palette.zinc950,
374+
outline: palette.blue400,
281375
},
376+
breakpoints,
377+
display,
378+
font,
379+
palette,
380+
typography,
282381
},
283382
dark: {
284383
colors: {
285-
background: pallete.zinc950,
286-
foreground: pallete.zinc50,
287-
card: pallete.zinc950,
288-
cardForeground: pallete.zinc50,
289-
popover: pallete.zinc950,
290-
popoverForeground: pallete.zinc50,
291-
primary: pallete.zinc50,
292-
primaryForeground: pallete.zinc900,
293-
secondary: pallete.zinc800,
294-
secondaryForeground: pallete.zinc50,
295-
muted: pallete.zinc800,
296-
mutedForeground: pallete.zinc400,
297-
accent: pallete.zinc800,
298-
accentForeground: pallete.zinc50,
299-
destructive: pallete.red900,
300-
destructiveForeground: pallete.zinc50,
301-
border: pallete.zinc800,
302-
input: pallete.zinc800,
303-
ring: pallete.zinc300,
304-
outline: pallete.blue400,
384+
background: palette.zinc950,
385+
foreground: palette.zinc50,
386+
card: palette.zinc950,
387+
cardForeground: palette.zinc50,
388+
popover: palette.zinc950,
389+
popoverForeground: palette.zinc50,
390+
primary: palette.zinc50,
391+
primaryForeground: palette.zinc900,
392+
secondary: palette.zinc800,
393+
secondaryForeground: palette.zinc50,
394+
muted: palette.zinc800,
395+
mutedForeground: palette.zinc400,
396+
accent: palette.zinc800,
397+
accentForeground: palette.zinc50,
398+
info: palette.blue900,
399+
success: palette.green900,
400+
warning: palette.yellow900,
401+
destructive: palette.red900,
402+
destructiveForeground: palette.zinc50,
403+
border: palette.zinc800,
404+
input: palette.zinc800,
405+
ring: palette.zinc300,
406+
outline: palette.blue400,
305407
},
408+
breakpoints,
409+
display,
410+
font,
411+
palette,
412+
typography,
306413
},
307-
}
414+
} as const;
308415

309416
export const initialTheme: Themes = 'light'

toolkit/storybook/common/utils/blocks.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {useState, useEffect} from 'react';
77
import {ColorPalette, ColorItem, IconGallery, IconItem} from '@storybook/blocks';
88
import {extractBasics, extractScales, getBasicProps} from 'utils/colors';
99
import {loadIconSet} from 'utils/icons';
10-
import {pallete} from 'design/theme';
10+
import {palette} from 'design/theme';
1111
import {Icon} from 'react-exo/icon';
1212

1313
export function Story(props: React.PropsWithChildren) {
@@ -21,8 +21,8 @@ export function Story(props: React.PropsWithChildren) {
2121
export function Colors() {
2222
return (
2323
<ColorPalette>
24-
<ColorItem {...getBasicProps(extractBasics(pallete))}/>
25-
{Object.entries(extractScales(pallete)).map(([name, colors]) => (
24+
<ColorItem {...getBasicProps(extractBasics(palette))}/>
25+
{Object.entries(extractScales(palette)).map(([name, colors]) => (
2626
<ColorItem
2727
key={name}
2828
title={name.charAt(0).toUpperCase() + name.slice(1)}

0 commit comments

Comments
 (0)