-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy paththeme.ts
58 lines (49 loc) · 1.67 KB
/
theme.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
50
51
52
53
54
55
56
57
58
import { DefaultTheme } from 'styled-components';
import { Spaces } from './Spaces/Spaces';
import { Breakpoints, MediaQueries } from './Breakpoints/Breakpoints';
const theme: DefaultTheme = {
breakpoints: Breakpoints,
fontSizes: ['0.75rem', '0.875rem', '1rem', '1.25rem', '1.5rem', '2rem', '2.5rem', '3rem'],
fontWeights: {
normal: 400,
semibold: 600,
bold: 700
},
fonts: {
normal: fontStack(['Open Sans', 'sans-serif']),
monospace: fontStack(['Hack', 'monospace'])
},
mediaQueries: MediaQueries,
space: Spaces,
radii: ['0rem', '0.125rem', '0.25rem', '0.5rem'],
iconSizes: {
small: 12,
medium: 24,
large: 28
},
shadows: {
small: '0 0.0625rem 0.25rem 0 rgba(0,0,0,0.1)',
medium: '0 0 0.5rem 0.1875rem rgba(0,0,0,0.08)',
large: '0 0 0.75rem 0.25rem rgba(0,0,0,0.12)'
}
};
/**
* Custom aliases declaration
* https://styled-system.com/theme-specification/#scale-aliases
*/
/* eslint-disable prefer-destructuring */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
theme.fontSizes.small = theme.fontSizes[1];
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
theme.fontSizes.medium = theme.fontSizes[2];
// TODO: the alias large should match with scale on theme "fontSizes" but it may require a breaking change
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
theme.fontSizes.large = '1.125rem';
/* eslint-enable prefer-destructuring */
function fontStack(fonts: string[]): string {
return fonts.map(font => (font.includes(' ') ? `"${font}"` : font)).join(', ');
}
export { theme };