-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdesign-system.ts
49 lines (39 loc) · 1.19 KB
/
design-system.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import color from './settings/colorPalette'
import { BreakpointNames, breakpoints, mediaquery } from './settings/responsive'
export { BreakpointNames, BreakpointProps } from './settings/responsive'
const BASE_SIZE = 16
const GRID_SIZE = 8
export type ColumnSizes = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13
const fontSize = (size: number) => `${size / BASE_SIZE}rem`
export const ds = {
/**
* DECLARATIONS
*/
color,
breakpoints,
breakpointKeys: Object.keys(breakpoints),
grid: {
maxWidth: '1024px',
columns: 12,
columnSize: 100 / 12,
},
font: {
smallest: fontSize(12),
small: fontSize(14),
normal: fontSize(18),
big: fontSize(24),
biggest: fontSize(42),
},
fontFamily: {
body: 'saens',
heading: 'lato',
},
/**
* UTILITIES
*/
unit: (unit: number, base: number = BASE_SIZE) => (GRID_SIZE * unit) / base,
spacing: (unit: number, base: number = BASE_SIZE) => `${ds.unit(unit, base)}rem`,
em: (px: number, base: number = BASE_SIZE) => `${px / base}em`,
mq: (bp: BreakpointNames, content: string) => mediaquery(bp, content),
}
export default ds