-
Notifications
You must be signed in to change notification settings - Fork 56
/
stitches.config.ts
143 lines (137 loc) · 2.59 KB
/
stitches.config.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import { createStitches } from "@stitches/react";
import {
gray,
blue,
green,
red,
yellow,
grayDark,
blueDark,
yellowDark,
} from "@radix-ui/colors";
const SPACING = {
px: "1px",
0: "0",
0.5: "0.125rem",
1: "0.25rem",
1.5: "0.375rem",
2: "0.5rem",
2.5: "0.625rem",
3: "0.75rem",
3.5: "0.875rem",
4: "1rem",
5: "1.25rem",
6: "1.5rem",
7: "1.75rem",
8: "2rem",
9: "2.25rem",
10: "2.5rem",
11: "2.75rem",
12: "3rem",
14: "3.5rem",
16: "4rem",
20: "5rem",
24: "6rem",
28: "7rem",
32: "8rem",
36: "9rem",
40: "10rem",
44: "11rem",
48: "12rem",
52: "13rem",
56: "14rem",
60: "15rem",
64: "16rem",
72: "18rem",
80: "20rem",
96: "24rem",
} as const;
const rename = (from, to, obj) => {
const newObj = {};
for (const key in obj) {
const [, num] = key.split(from);
newObj[`${to}${num}`] = obj[key];
}
return newObj;
};
export const baseTheme = {
colors: {
...gray,
...blue,
...green,
...red,
...yellow,
},
fonts: {
serif: `PP Editorial New, ui-serif, Georgia, serif`,
mono: `JetBrains Mono, ui-monospace, Menlo, Monaco, "Segoe UI Mono", "Roboto Mono", monospace`,
sans: `Nunito, system-ui, -apple-system, sans-serif`,
},
fontSizes: {
sm: "0.875rem",
base: "1rem",
lg: "1.25rem",
xl: "1.5rem",
"2xl": "1.875rem",
},
space: SPACING,
sizes: SPACING,
lineHeights: {
body: 1.7,
title: 1.1,
},
shadows: {
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
sm: "0 8px 16px hsla(0, 0%, 0%, 0.03)",
},
radii: {
base: "6px",
lg: "12px",
},
};
export const { styled, getCssText, globalCss, createTheme, css, keyframes } =
createStitches({
media: {
post: `(min-width: 50rem)`,
md: `(min-width: 768px)`,
lg: `(min-width: 62em)`,
xl: `(min-width: 80em)`,
},
theme: baseTheme,
});
export const darkTheme = createTheme({
colors: {
...grayDark,
...rename("blue", "blueDark", blueDark),
...rename("yellow", "yellowDark", yellowDark),
},
});
export const globalStyles = globalCss({
"*": {
boxSizing: "border-box",
margin: 0,
padding: 0,
"-webkit-font-smoothing": "antialiased",
"-moz-osx-font-smoothing": "grayscale",
},
"input, button": {
all: "unset",
},
button: {
cursor: "pointer",
},
body: {
fontFamily: "$sans",
background: "$gray4",
},
"h1, h2": {
fontWeight: "normal",
},
/* as recommended in https://rehype-pretty-code.netlify.app/ */
"pre > code": {
display: "grid",
},
code: {
fontFamily: "$mono",
},
});