-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.ts
44 lines (39 loc) · 1.38 KB
/
tailwind.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
import type { Config } from "tailwindcss";
import plugin from "tailwindcss/plugin";
import type { responsiveToken } from "./jokul-tokens";
import tokens from "./jokul-tokens";
import { breakpoints } from "@fremtind/jkl-core";
const responsiveTokenToCssInJss = (rule: responsiveToken) => ({
...rule.small,
[`@media (min-width: ${breakpoints.medium}px)`]: {
...rule.base,
},
});
const convertTokenToCssInJss = (token: Record<string, any>) =>
Object.fromEntries(Object.entries(token).map(([key, value]) => [`.j-${key}`, responsiveTokenToCssInJss(value)]));
const { body, h1, h2, h3, h4, h5, small, title, titleSmall } = tokens.typography;
const typographyTokens = convertTokenToCssInJss({ body, h1, h2, h3, h4, h5, small, title, titleSmall });
export default {
content: ["./app/**/*.{js,jsx,ts,tsx}"],
theme: {
colors: {
...tokens.color,
sb1: {
fjell: "#005AA4",
vann: "#002776",
},
"dnb": {
"sea-green": "#007272",
}
},
spacing: tokens.spacing,
fontSize: tokens.typography.font.size,
lineHeight: tokens.typography.line.height,
fontweight: tokens.typography.weight,
},
plugins: [
plugin(function ({ addComponents }) {
addComponents(typographyTokens);
}),
],
} satisfies Config;