@obosbbl/grunnmuren-tailwind 0.9.1 → 2.0.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +47 -20
- package/package.json +8 -10
- package/tailwind-base.cjs +259 -362
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,48 +1,75 @@
|
|
|
1
1
|
# @obosbbl/grunnmuren-tailwind
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@obosbbl/grunnmuren-tailwind)
|
|
4
|
+
|
|
5
|
+
Grunnmuren Tailwind preset. See the [Tailwind documentation](https://tailwindcss.com/docs/presets) for more information about how presets work.
|
|
4
6
|
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
```sh
|
|
8
|
-
npm
|
|
10
|
+
# npm
|
|
11
|
+
npm install -D @obosbbl/grunnmuren-tailwind@canary tailwindcss postcss autoprefixer
|
|
12
|
+
|
|
13
|
+
# pnpm
|
|
14
|
+
pnpm add -D @obosbbl/grunnmuren-tailwind@canary tailwindcss postcss autoprefixer
|
|
9
15
|
```
|
|
10
16
|
|
|
11
17
|
## Usage
|
|
12
18
|
|
|
19
|
+
Configure Tailwind to use the preset
|
|
20
|
+
|
|
13
21
|
```js
|
|
14
22
|
// tailwind.config.js
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
/** @type {import('tailwindcss').Config} */
|
|
17
25
|
module.exports = {
|
|
18
26
|
presets: [require('@obosbbl/grunnmuren-tailwind')],
|
|
19
27
|
content: [
|
|
20
|
-
// If using this together with Grunnmuren's React components
|
|
21
|
-
'./node_modules/@obosbbl/grunnmuren-react/dist/**/*.js',
|
|
22
28
|
// Add your own content sources as needed, eg:
|
|
23
|
-
'./src/
|
|
29
|
+
'./src/app/**/*.{js,ts,jsx,tsx,}',
|
|
30
|
+
|
|
31
|
+
// If you're using Grunnmuren's React components
|
|
32
|
+
'./node_modules/@obosbbl/grunnmuren-react/dist/**/*.mjs',
|
|
24
33
|
],
|
|
25
34
|
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Add the Tailwind directives to your CSS
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
/* globals.css */
|
|
41
|
+
|
|
42
|
+
@tailwind base;
|
|
43
|
+
@tailwind components;
|
|
44
|
+
@tailwind utilities;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Configure PostCSS to use Tailwind
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
// postcss.config.js
|
|
26
51
|
|
|
27
|
-
// Usage with options
|
|
28
52
|
module.exports = {
|
|
29
|
-
|
|
30
|
-
|
|
53
|
+
plugins: {
|
|
54
|
+
tailwindcss: {},
|
|
55
|
+
autoprefixer: {},
|
|
56
|
+
},
|
|
31
57
|
};
|
|
32
58
|
```
|
|
33
59
|
|
|
34
|
-
|
|
60
|
+
## Migrating from v1?
|
|
35
61
|
|
|
36
|
-
|
|
37
|
-
You'll have to setup your app so it serves the necessary [font files](../react/public/fonts/).
|
|
38
|
-
By default the fonts should be under `/fonts/` but you can override this with the config option `fontBasePath`.
|
|
39
|
-
See the [preset implementation](./tailwind-base.cjs).
|
|
62
|
+
To ease the transition from v1 to v2 of Grunnmuren, it is possible to configure the preset to be (partially) compatible with v1. This allows you to use v2 of the Tailwind preset with v1 of the React components, and upgrade your application over time instead of a full migration.
|
|
40
63
|
|
|
41
|
-
|
|
64
|
+
To do that you need to configure the preset with `legacyV1Compatibility` option.
|
|
42
65
|
|
|
43
|
-
|
|
66
|
+
```js
|
|
67
|
+
// tailwind.config.js
|
|
44
68
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
69
|
+
/** @type {import('tailwindcss').Config} */
|
|
70
|
+
module.exports = {
|
|
71
|
+
presets: [
|
|
72
|
+
require('@obosbbl/grunnmuren-tailwind')({ legacyV1Compatibility: true }),
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
```
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@obosbbl/grunnmuren-tailwind",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0-canary.1",
|
|
4
4
|
"description": "Grunnmuren Tailwind preset",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "commonjs",
|
|
7
5
|
"repository": {
|
|
8
|
-
"url": "https://github.com/code-obos/grunnmuren"
|
|
9
|
-
"directory": "packages/tailwind"
|
|
6
|
+
"url": "https://github.com/code-obos/grunnmuren"
|
|
10
7
|
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"type": "commonjs",
|
|
11
10
|
"exports": {
|
|
12
11
|
".": "./tailwind-base.cjs"
|
|
13
12
|
},
|
|
@@ -15,14 +14,13 @@
|
|
|
15
14
|
"tailwind-base.cjs"
|
|
16
15
|
],
|
|
17
16
|
"dependencies": {
|
|
18
|
-
"@tailwindcss/aspect-ratio": "0.4.2",
|
|
19
|
-
"@tailwindcss/typography": "0.5.
|
|
17
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
18
|
+
"@tailwindcss/typography": "^0.5.10"
|
|
20
19
|
},
|
|
21
20
|
"devDependencies": {
|
|
22
|
-
"tailwindcss": "3.3.
|
|
23
|
-
"postcss": "8.4.23"
|
|
21
|
+
"tailwindcss": "3.3.5"
|
|
24
22
|
},
|
|
25
23
|
"peerDependencies": {
|
|
26
|
-
"tailwindcss": "^3.
|
|
24
|
+
"tailwindcss": "^3.3.5"
|
|
27
25
|
}
|
|
28
26
|
}
|
package/tailwind-base.cjs
CHANGED
|
@@ -1,52 +1,283 @@
|
|
|
1
1
|
const plugin = require('tailwindcss/plugin');
|
|
2
2
|
|
|
3
|
-
// naively assume all fonts are hosted at the following paths at the root of the app
|
|
4
|
-
const gorditaFonts = [
|
|
5
|
-
{
|
|
6
|
-
fontWeight: 400,
|
|
7
|
-
fontStyle: 'normal',
|
|
8
|
-
url: '/gorditaregular-webfont.woff2',
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
fontWeight: 400,
|
|
12
|
-
fontStyle: 'italic',
|
|
13
|
-
url: '/gorditaregularitalic-webfont.woff2',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
fontWeight: 500,
|
|
17
|
-
fontStyle: 'normal',
|
|
18
|
-
url: '/gorditamedium-webfont.woff2',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
fontWeight: 700,
|
|
22
|
-
fontStyle: 'normal',
|
|
23
|
-
url: '/gorditabold-webfont.woff2',
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
|
|
27
3
|
const obosFonts = [
|
|
28
4
|
{
|
|
29
5
|
fontWeight: 400,
|
|
30
6
|
fontStyle: 'normal',
|
|
31
|
-
url: '/OBOSText-Regular.woff2',
|
|
7
|
+
url: 'https://www.obos.no/fonts/OBOSText-Regular.woff2',
|
|
32
8
|
},
|
|
33
9
|
{
|
|
34
10
|
fontWeight: 400,
|
|
35
11
|
fontStyle: 'italic',
|
|
36
|
-
url: '/OBOSText-Italic.woff2',
|
|
12
|
+
url: 'https://www.obos.no/fonts/OBOSText-Italic.woff2',
|
|
37
13
|
},
|
|
38
14
|
{
|
|
39
15
|
fontWeight: 500,
|
|
40
16
|
fontStyle: 'normal',
|
|
41
|
-
url: '/OBOSText-Medium.woff2',
|
|
17
|
+
url: 'https://www.obos.no/fonts/OBOSText-Medium.woff2',
|
|
42
18
|
},
|
|
43
19
|
{
|
|
44
20
|
fontWeight: 700,
|
|
45
21
|
fontStyle: 'normal',
|
|
46
|
-
url: '/OBOSText-Bold.woff2',
|
|
22
|
+
url: 'https://www.obos.no/fonts/OBOSText-Bold.woff2',
|
|
47
23
|
},
|
|
48
24
|
];
|
|
49
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @param {boolean} options.legacyV1Compatibility
|
|
28
|
+
*/
|
|
29
|
+
module.exports = (options = {}) => {
|
|
30
|
+
const v1CompatibilityPlugins = [];
|
|
31
|
+
|
|
32
|
+
if (options.legacyV1Compatibility) {
|
|
33
|
+
v1CompatibilityPlugins.push(
|
|
34
|
+
button,
|
|
35
|
+
checkbox,
|
|
36
|
+
radio,
|
|
37
|
+
snackbar,
|
|
38
|
+
require('@tailwindcss/aspect-ratio'),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const fontFamily = 'OBOSFont';
|
|
43
|
+
const fonts = obosFonts;
|
|
44
|
+
const containerSize = '92rem';
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
plugins: [
|
|
48
|
+
...v1CompatibilityPlugins,
|
|
49
|
+
require('@tailwindcss/typography'),
|
|
50
|
+
plugin(function ({ addBase, addComponents }) {
|
|
51
|
+
addBase({
|
|
52
|
+
html: {
|
|
53
|
+
'@apply text-black antialiased font-normal': {},
|
|
54
|
+
},
|
|
55
|
+
b: {
|
|
56
|
+
fontWeight: 500,
|
|
57
|
+
},
|
|
58
|
+
strong: {
|
|
59
|
+
fontWeight: 500,
|
|
60
|
+
},
|
|
61
|
+
a: {
|
|
62
|
+
'text-decoration': 'underline',
|
|
63
|
+
},
|
|
64
|
+
'::selection': { '@apply bg-mint text-black': {} },
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
addComponents({
|
|
68
|
+
'.container': {
|
|
69
|
+
width: '100%',
|
|
70
|
+
paddingLeft: '1rem',
|
|
71
|
+
paddingRight: '1rem',
|
|
72
|
+
marginLeft: 'auto',
|
|
73
|
+
marginRight: 'auto',
|
|
74
|
+
maxWidth: containerSize,
|
|
75
|
+
},
|
|
76
|
+
'.container-prose': {
|
|
77
|
+
width: '100%',
|
|
78
|
+
paddingLeft: '1rem',
|
|
79
|
+
paddingRight: '1rem',
|
|
80
|
+
marginLeft: 'auto',
|
|
81
|
+
marginRight: 'auto',
|
|
82
|
+
maxWidth: '45.5rem',
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
}),
|
|
86
|
+
|
|
87
|
+
plugin(function ({ addBase, addComponents }) {
|
|
88
|
+
// This is tailwind syntax for setting both the font-size and the line-height
|
|
89
|
+
const h1 = '@apply font-bold text-[28px]/[38px] md:text-[40px]/[56px]';
|
|
90
|
+
const h2 = '@apply font-bold text-[24px]/[30px] md:text-[32px]/[42px]';
|
|
91
|
+
const h3 = '@apply font-bold text-[20px]/[30px] md:text-[24px]/[34px]';
|
|
92
|
+
const h4 = '@apply font-bold text-[18px]/[24px] md:text-[20px]/[28px]';
|
|
93
|
+
|
|
94
|
+
if (options.legacyV1Compatibility) {
|
|
95
|
+
addBase({
|
|
96
|
+
h1: {
|
|
97
|
+
[h1]: {},
|
|
98
|
+
},
|
|
99
|
+
h2: {
|
|
100
|
+
[h2]: {},
|
|
101
|
+
},
|
|
102
|
+
h3: {
|
|
103
|
+
[h3]: {},
|
|
104
|
+
},
|
|
105
|
+
h4: {
|
|
106
|
+
[h4]: {},
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
addComponents({
|
|
112
|
+
'.h1': {
|
|
113
|
+
[h1]: {},
|
|
114
|
+
},
|
|
115
|
+
'.h2': {
|
|
116
|
+
[h2]: {},
|
|
117
|
+
},
|
|
118
|
+
'.h3': {
|
|
119
|
+
[h3]: {},
|
|
120
|
+
},
|
|
121
|
+
'.h4': {
|
|
122
|
+
[h4]: {},
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
}),
|
|
126
|
+
plugin(function ({ addBase }) {
|
|
127
|
+
addBase(
|
|
128
|
+
fonts.map((font) => ({
|
|
129
|
+
'@font-face': {
|
|
130
|
+
fontFamily,
|
|
131
|
+
fontWeight: font.fontWeight,
|
|
132
|
+
fontStyle: font.fontStyle,
|
|
133
|
+
src: `url('${font.url}') format('woff2')`,
|
|
134
|
+
fontDisplay: 'swap',
|
|
135
|
+
},
|
|
136
|
+
})),
|
|
137
|
+
);
|
|
138
|
+
}),
|
|
139
|
+
],
|
|
140
|
+
theme: {
|
|
141
|
+
colors: {
|
|
142
|
+
inherit: 'inherit',
|
|
143
|
+
current: 'currentColor',
|
|
144
|
+
transparent: 'transparent',
|
|
145
|
+
black: '#333',
|
|
146
|
+
white: '#fff',
|
|
147
|
+
gray: {
|
|
148
|
+
DEFAULT: '#818181',
|
|
149
|
+
dark: '#595959',
|
|
150
|
+
light: '#E6E6E6',
|
|
151
|
+
lightest: '#f1f1f1',
|
|
152
|
+
},
|
|
153
|
+
sky: {
|
|
154
|
+
DEFAULT: '#BEDFEC',
|
|
155
|
+
light: '#DEEFF5',
|
|
156
|
+
lightest: '#EBF5F9',
|
|
157
|
+
},
|
|
158
|
+
mint: {
|
|
159
|
+
DEFAULT: '#CDECE2',
|
|
160
|
+
light: '#E6F5F0',
|
|
161
|
+
lightest: '#F0F9F6',
|
|
162
|
+
},
|
|
163
|
+
blue: {
|
|
164
|
+
// OBOS Blue/Primary brand
|
|
165
|
+
DEFAULT: '#0047BA',
|
|
166
|
+
light: '#BEDFEC',
|
|
167
|
+
lightest: '#DEEFF5',
|
|
168
|
+
// OBOS Ocean
|
|
169
|
+
dark: '#002169',
|
|
170
|
+
},
|
|
171
|
+
green: {
|
|
172
|
+
// OBOS Green/Primary brand
|
|
173
|
+
DEFAULT: '#008761',
|
|
174
|
+
lightest: '#E6F5F0',
|
|
175
|
+
light: '#CDECE2',
|
|
176
|
+
// OBOS Forest
|
|
177
|
+
dark: '#00524C',
|
|
178
|
+
},
|
|
179
|
+
red: {
|
|
180
|
+
DEFAULT: '#C0385D',
|
|
181
|
+
// error red
|
|
182
|
+
light: '#FAEDEF',
|
|
183
|
+
},
|
|
184
|
+
orange: {
|
|
185
|
+
DEFAULT: '#e8a74a',
|
|
186
|
+
light: '#f8e5c9',
|
|
187
|
+
},
|
|
188
|
+
yellow: {
|
|
189
|
+
// open house
|
|
190
|
+
DEFAULT: '#fff5d2',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
fontFamily: {
|
|
194
|
+
sans: [fontFamily, 'sans-serif'],
|
|
195
|
+
},
|
|
196
|
+
extend: {
|
|
197
|
+
maxWidth: {
|
|
198
|
+
// Override Tailwinds default prose width of 60 chars.
|
|
199
|
+
prose: '696px',
|
|
200
|
+
},
|
|
201
|
+
width: {
|
|
202
|
+
prose: '696px',
|
|
203
|
+
},
|
|
204
|
+
spacing: {
|
|
205
|
+
18: '4.5rem',
|
|
206
|
+
},
|
|
207
|
+
borderColor: options.legacyV1Compatibility
|
|
208
|
+
? ({ theme }) => ({
|
|
209
|
+
DEFAULT: theme('colors.gray.light', 'currentColor'),
|
|
210
|
+
})
|
|
211
|
+
: undefined,
|
|
212
|
+
typography: (theme) => ({
|
|
213
|
+
DEFAULT: {
|
|
214
|
+
css: {
|
|
215
|
+
'--tw-prose-headings': 'inherit',
|
|
216
|
+
'--tw-prose-lead': 'inherit',
|
|
217
|
+
'--tw-prose-links': 'inherit',
|
|
218
|
+
'--tw-prose-quotes': theme('colors.blue.dark'),
|
|
219
|
+
'--tw-prose-quote-borders': theme('colors.green.DEFAULT'),
|
|
220
|
+
'--tw-prose-counters': theme('colors.black'),
|
|
221
|
+
'--tw-prose-bullets': theme('colors.green.DEFAULT'),
|
|
222
|
+
color: theme('colors.black'),
|
|
223
|
+
maxWidth: theme('maxWidth.prose'),
|
|
224
|
+
a: {
|
|
225
|
+
fontWeight: 400,
|
|
226
|
+
},
|
|
227
|
+
h1: {
|
|
228
|
+
fontWeight: theme('fontWeight.bold'),
|
|
229
|
+
fontSize: theme('fontSize.3xl'),
|
|
230
|
+
'@media (min-width: theme("screens.md"))': {
|
|
231
|
+
fontSize: theme('fontSize.5xl'),
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
h2: {
|
|
235
|
+
fontWeight: theme('fontWeight.bold'),
|
|
236
|
+
fontSize: theme('fontSize.2xl'),
|
|
237
|
+
'@media (min-width: theme("screens.md"))': {
|
|
238
|
+
fontSize: theme('fontSize.4xl'),
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
h3: {
|
|
242
|
+
fontWeight: theme('fontWeight.bold'),
|
|
243
|
+
fontSize: theme('fontSize.xl'),
|
|
244
|
+
'@media (min-width: theme("screens.md"))': {
|
|
245
|
+
fontSize: theme('fontSize.2xl'),
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
h4: {
|
|
249
|
+
fontWeight: theme('fontWeight.bold'),
|
|
250
|
+
fontSize: theme('fontSize.lg'),
|
|
251
|
+
'@media (min-width: theme("screens.md"))': {
|
|
252
|
+
fontSize: theme('fontSize.xl'),
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
li: {
|
|
256
|
+
marginTop: '1.5em',
|
|
257
|
+
marginBottom: '1.5em',
|
|
258
|
+
},
|
|
259
|
+
blockquote: {
|
|
260
|
+
fontWeight: theme('fontWeight.bold'),
|
|
261
|
+
fontStyle: 'normal',
|
|
262
|
+
},
|
|
263
|
+
'blockquote p:first-of-type::before': {
|
|
264
|
+
content: '"«"',
|
|
265
|
+
},
|
|
266
|
+
'blockquote p:last-of-type::after': {
|
|
267
|
+
content: '"»"',
|
|
268
|
+
},
|
|
269
|
+
'[class~="lead"]': {
|
|
270
|
+
fontWeight: theme('fontWeight.medium'),
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
}),
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// These custom components are only used for v1 compat
|
|
50
281
|
const button = plugin(function ({ addComponents, theme }) {
|
|
51
282
|
const hoverLoadingBgColor = 'rgba(0, 0, 0, 0.1)';
|
|
52
283
|
|
|
@@ -170,43 +401,6 @@ const checkbox = plugin(function ({ addComponents, theme }) {
|
|
|
170
401
|
});
|
|
171
402
|
});
|
|
172
403
|
|
|
173
|
-
const headings = plugin(function ({ addBase, addComponents }) {
|
|
174
|
-
const h1 = '@apply font-bold text-3xl md:text-5xl';
|
|
175
|
-
const h2 = '@apply font-bold text-2xl md:text-4xl';
|
|
176
|
-
const h3 = '@apply font-bold text-xl md:text-2xl';
|
|
177
|
-
const h4 = '@apply font-bold text-lg md:text-xl';
|
|
178
|
-
|
|
179
|
-
addBase({
|
|
180
|
-
h1: {
|
|
181
|
-
[h1]: {},
|
|
182
|
-
},
|
|
183
|
-
h2: {
|
|
184
|
-
[h2]: {},
|
|
185
|
-
},
|
|
186
|
-
h3: {
|
|
187
|
-
[h3]: {},
|
|
188
|
-
},
|
|
189
|
-
h4: {
|
|
190
|
-
[h4]: {},
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
addComponents({
|
|
195
|
-
'.h1': {
|
|
196
|
-
[h1]: {},
|
|
197
|
-
},
|
|
198
|
-
'.h2': {
|
|
199
|
-
[h2]: {},
|
|
200
|
-
},
|
|
201
|
-
'.h3': {
|
|
202
|
-
[h3]: {},
|
|
203
|
-
},
|
|
204
|
-
'.h4': {
|
|
205
|
-
[h4]: {},
|
|
206
|
-
},
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
|
|
210
404
|
const snackbar = plugin(function ({ addComponents, theme }) {
|
|
211
405
|
addComponents({
|
|
212
406
|
'.snackbar': {
|
|
@@ -233,300 +427,3 @@ const snackbar = plugin(function ({ addComponents, theme }) {
|
|
|
233
427
|
},
|
|
234
428
|
});
|
|
235
429
|
});
|
|
236
|
-
|
|
237
|
-
const defaultOpts = {
|
|
238
|
-
useLegacyFont: false,
|
|
239
|
-
fontBasePath: '/fonts',
|
|
240
|
-
useLegacyContainerSize: false,
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
module.exports = (userOptions) => {
|
|
244
|
-
const opts = userOptions ? { ...defaultOpts, ...userOptions } : defaultOpts;
|
|
245
|
-
let fontFamily = 'OBOSFont';
|
|
246
|
-
let fonts = obosFonts;
|
|
247
|
-
let containerSize = '92rem';
|
|
248
|
-
if (opts.useLegacyFont) {
|
|
249
|
-
fontFamily = 'Gordita';
|
|
250
|
-
fonts = gorditaFonts;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (opts.useLegacyContainerSize) {
|
|
254
|
-
containerSize = '82rem';
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return {
|
|
258
|
-
plugins: [
|
|
259
|
-
// TODO: Remove the aspect ratio plugin when Safari 14 usage is low enough
|
|
260
|
-
require('@tailwindcss/aspect-ratio'),
|
|
261
|
-
require('@tailwindcss/typography'),
|
|
262
|
-
button,
|
|
263
|
-
headings,
|
|
264
|
-
checkbox,
|
|
265
|
-
snackbar,
|
|
266
|
-
radio,
|
|
267
|
-
plugin(function ({ addBase, addUtilities, addComponents, theme }) {
|
|
268
|
-
addBase({
|
|
269
|
-
html: {
|
|
270
|
-
'@apply text-black antialiased font-normal': {},
|
|
271
|
-
},
|
|
272
|
-
b: {
|
|
273
|
-
fontWeight: 500,
|
|
274
|
-
},
|
|
275
|
-
strong: {
|
|
276
|
-
fontWeight: 500,
|
|
277
|
-
},
|
|
278
|
-
a: {
|
|
279
|
-
'@apply underline': {},
|
|
280
|
-
},
|
|
281
|
-
'::selection': { '@apply bg-mint text-black': {} },
|
|
282
|
-
// Remove the disclosure triangle in Safari if apply the `list-none` utility to the summary element
|
|
283
|
-
'summary.list-none::-webkit-details-marker': {
|
|
284
|
-
display: 'none',
|
|
285
|
-
},
|
|
286
|
-
});
|
|
287
|
-
addComponents({
|
|
288
|
-
'.container': {
|
|
289
|
-
width: '100%',
|
|
290
|
-
paddingLeft: '1rem',
|
|
291
|
-
paddingRight: '1rem',
|
|
292
|
-
marginLeft: 'auto',
|
|
293
|
-
marginRight: 'auto',
|
|
294
|
-
maxWidth: containerSize,
|
|
295
|
-
},
|
|
296
|
-
'.container-prose': {
|
|
297
|
-
width: '100%',
|
|
298
|
-
paddingLeft: '1rem',
|
|
299
|
-
paddingRight: '1rem',
|
|
300
|
-
marginLeft: 'auto',
|
|
301
|
-
marginRight: 'auto',
|
|
302
|
-
maxWidth: '45.5rem',
|
|
303
|
-
},
|
|
304
|
-
// that thin blue line at the top
|
|
305
|
-
'.topline::before': {
|
|
306
|
-
display: 'block',
|
|
307
|
-
width: '100%',
|
|
308
|
-
height: '5px',
|
|
309
|
-
content: '""',
|
|
310
|
-
position: 'fixed',
|
|
311
|
-
left: '0',
|
|
312
|
-
top: '0',
|
|
313
|
-
right: '0',
|
|
314
|
-
backgroundColor: theme('colors.blue.DEFAULT'),
|
|
315
|
-
zIndex: '100',
|
|
316
|
-
},
|
|
317
|
-
/**
|
|
318
|
-
* @deprecated use page-layout and page-layout-main instead
|
|
319
|
-
*/
|
|
320
|
-
'.pagemain': {
|
|
321
|
-
backgroundColor: '#fff',
|
|
322
|
-
borderRadius: '1.5rem',
|
|
323
|
-
overflow: 'hidden',
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
'.page-layout': {
|
|
327
|
-
display: 'flex',
|
|
328
|
-
flexDirection: 'column',
|
|
329
|
-
minHeight: '100vh',
|
|
330
|
-
},
|
|
331
|
-
'.page-layout-main': {
|
|
332
|
-
backgroundColor: '#fff',
|
|
333
|
-
flexGrow: '1',
|
|
334
|
-
},
|
|
335
|
-
});
|
|
336
|
-
addUtilities({
|
|
337
|
-
// imitates a bold font, but doesn't cause layout due to element width change like with font-weight
|
|
338
|
-
// Note that this CSS isn't standardized, but it works in Fx, Chrome, Safari and Edge
|
|
339
|
-
/**
|
|
340
|
-
* @deprecated use font-bold instead
|
|
341
|
-
*/
|
|
342
|
-
'.fake-font-bold': {
|
|
343
|
-
'-webkit-text-stroke': '1px',
|
|
344
|
-
},
|
|
345
|
-
});
|
|
346
|
-
}),
|
|
347
|
-
plugin(function ({ addBase }) {
|
|
348
|
-
addBase(
|
|
349
|
-
fonts.map((font) => ({
|
|
350
|
-
'@font-face': {
|
|
351
|
-
fontFamily,
|
|
352
|
-
fontWeight: font.fontWeight,
|
|
353
|
-
fontStyle: font.fontStyle,
|
|
354
|
-
src: `url('${opts.fontBasePath}${font.url}') format('woff2')`,
|
|
355
|
-
fontDisplay: 'swap',
|
|
356
|
-
},
|
|
357
|
-
})),
|
|
358
|
-
);
|
|
359
|
-
}),
|
|
360
|
-
],
|
|
361
|
-
corePlugins: {
|
|
362
|
-
container: false,
|
|
363
|
-
},
|
|
364
|
-
theme: {
|
|
365
|
-
fontSize: {
|
|
366
|
-
sm: '0.875rem',
|
|
367
|
-
base: '1rem',
|
|
368
|
-
lg: '1.125rem', // 18px
|
|
369
|
-
xl: '1.25rem', // 20px
|
|
370
|
-
'2xl': '1.5rem', // 24px
|
|
371
|
-
'3xl': '1.875rem', // 28px
|
|
372
|
-
'4xl': '2rem', // 32px
|
|
373
|
-
'5xl': '2.5rem', // 40px
|
|
374
|
-
},
|
|
375
|
-
extend: {
|
|
376
|
-
maxWidth: {
|
|
377
|
-
// Override Tailwinds default prose width of 60 chars to 48. Roughly 590 pixels
|
|
378
|
-
prose: '696px',
|
|
379
|
-
},
|
|
380
|
-
width: {
|
|
381
|
-
prose: '696px',
|
|
382
|
-
},
|
|
383
|
-
screens: {
|
|
384
|
-
'max-md': { max: '767.9px' },
|
|
385
|
-
/**
|
|
386
|
-
* @deprecated Tailwind 3.2 has built in support for max-width breakpoints, but it only works
|
|
387
|
-
* with a "simple screens" configuration... We add `max-md` manually here, allow everyone to migrate off
|
|
388
|
-
* `<md`, then we can remove `screens` enitrely from this config.
|
|
389
|
-
*/
|
|
390
|
-
'<md': { max: '767.9px' },
|
|
391
|
-
},
|
|
392
|
-
spacing: {
|
|
393
|
-
18: '4.5rem',
|
|
394
|
-
},
|
|
395
|
-
colors: {
|
|
396
|
-
black: '#333',
|
|
397
|
-
white: '#fff',
|
|
398
|
-
gray: {
|
|
399
|
-
// Dark Gray
|
|
400
|
-
dark: '#595959',
|
|
401
|
-
// gray
|
|
402
|
-
DEFAULT: '#818181',
|
|
403
|
-
// Light gray
|
|
404
|
-
light: '#E6E6E6',
|
|
405
|
-
// Lightest gray
|
|
406
|
-
lightest: '#f1f1f1',
|
|
407
|
-
// DEPRECATED concrete
|
|
408
|
-
concrete: '#f1f1f1',
|
|
409
|
-
},
|
|
410
|
-
sky: {
|
|
411
|
-
DEFAULT: '#BEDFEC',
|
|
412
|
-
light: '#DEEFF5',
|
|
413
|
-
lightest: '#EBF5F9',
|
|
414
|
-
},
|
|
415
|
-
mint: {
|
|
416
|
-
DEFAULT: '#CDECE2',
|
|
417
|
-
light: '#E6F5F0',
|
|
418
|
-
lightest: '#F0F9F6',
|
|
419
|
-
},
|
|
420
|
-
blue: {
|
|
421
|
-
// DEPRECATED light blue
|
|
422
|
-
lightest: '#DEEFF5',
|
|
423
|
-
// DEPRECATED OBOS Sky
|
|
424
|
-
light: '#BEDFEC',
|
|
425
|
-
|
|
426
|
-
// OBOS Blue/Primary brand
|
|
427
|
-
DEFAULT: '#0047BA',
|
|
428
|
-
// OBOS Ocean
|
|
429
|
-
dark: '#002169',
|
|
430
|
-
},
|
|
431
|
-
green: {
|
|
432
|
-
// DEPRECATED light green
|
|
433
|
-
lightest: '#E6F5F0',
|
|
434
|
-
// DEPRECATED OBOS Mint
|
|
435
|
-
light: '#CDECE2',
|
|
436
|
-
|
|
437
|
-
// OBOS Green/Primary brand
|
|
438
|
-
DEFAULT: '#008761',
|
|
439
|
-
// OBOS Forest
|
|
440
|
-
dark: '#00524C',
|
|
441
|
-
},
|
|
442
|
-
red: {
|
|
443
|
-
// error red
|
|
444
|
-
light: '#faedef',
|
|
445
|
-
DEFAULT: '#cd465e',
|
|
446
|
-
},
|
|
447
|
-
orange: {
|
|
448
|
-
light: '#f8e5c9',
|
|
449
|
-
DEFAULT: '#e8a74a',
|
|
450
|
-
},
|
|
451
|
-
yellow: {
|
|
452
|
-
// open house
|
|
453
|
-
DEFAULT: '#fff5d2',
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
borderColor: ({ theme }) => ({
|
|
457
|
-
DEFAULT: theme('colors.gray.light', 'currentColor'),
|
|
458
|
-
}),
|
|
459
|
-
fontFamily: {
|
|
460
|
-
sans: [fontFamily, 'sans-serif'],
|
|
461
|
-
},
|
|
462
|
-
boxShadow: {
|
|
463
|
-
DEFAULT: '0 6px 4px 0 rgba(0, 33, 105, 0.25)',
|
|
464
|
-
},
|
|
465
|
-
typography: (theme) => ({
|
|
466
|
-
DEFAULT: {
|
|
467
|
-
css: {
|
|
468
|
-
'--tw-prose-headings': 'inherit',
|
|
469
|
-
'--tw-prose-lead': 'inherit',
|
|
470
|
-
'--tw-prose-links': 'inherit',
|
|
471
|
-
'--tw-prose-quotes': theme('colors.blue.dark'),
|
|
472
|
-
'--tw-prose-quote-borders': theme('colors.green.DEFAULT'),
|
|
473
|
-
'--tw-prose-counters': theme('colors.black'),
|
|
474
|
-
// TODO: Increase bullet size. See design sketches
|
|
475
|
-
'--tw-prose-bullets': theme('colors.green.DEFAULT'),
|
|
476
|
-
color: theme('colors.black'),
|
|
477
|
-
maxWidth: theme('maxWidth.prose'),
|
|
478
|
-
a: {
|
|
479
|
-
fontWeight: 400,
|
|
480
|
-
},
|
|
481
|
-
h1: {
|
|
482
|
-
fontWeight: theme('fontWeight.bold'),
|
|
483
|
-
fontSize: theme('fontSize.3xl'),
|
|
484
|
-
'@media (min-width: theme("screens.md"))': {
|
|
485
|
-
fontSize: theme('fontSize.5xl'),
|
|
486
|
-
},
|
|
487
|
-
},
|
|
488
|
-
h2: {
|
|
489
|
-
fontWeight: theme('fontWeight.bold'),
|
|
490
|
-
fontSize: theme('fontSize.2xl'),
|
|
491
|
-
'@media (min-width: theme("screens.md"))': {
|
|
492
|
-
fontSize: theme('fontSize.4xl'),
|
|
493
|
-
},
|
|
494
|
-
},
|
|
495
|
-
h3: {
|
|
496
|
-
fontWeight: theme('fontWeight.bold'),
|
|
497
|
-
fontSize: theme('fontSize.xl'),
|
|
498
|
-
'@media (min-width: theme("screens.md"))': {
|
|
499
|
-
fontSize: theme('fontSize.2xl'),
|
|
500
|
-
},
|
|
501
|
-
},
|
|
502
|
-
h4: {
|
|
503
|
-
fontWeight: theme('fontWeight.bold'),
|
|
504
|
-
fontSize: theme('fontSize.lg'),
|
|
505
|
-
'@media (min-width: theme("screens.md"))': {
|
|
506
|
-
fontSize: theme('fontSize.xl'),
|
|
507
|
-
},
|
|
508
|
-
},
|
|
509
|
-
li: {
|
|
510
|
-
marginTop: '1.5em',
|
|
511
|
-
marginBottom: '1.5em',
|
|
512
|
-
},
|
|
513
|
-
blockquote: {
|
|
514
|
-
fontWeight: theme('fontWeight.bold'),
|
|
515
|
-
fontStyle: 'normal',
|
|
516
|
-
},
|
|
517
|
-
'blockquote p:first-of-type::before': {
|
|
518
|
-
content: '"«"',
|
|
519
|
-
},
|
|
520
|
-
'blockquote p:last-of-type::after': {
|
|
521
|
-
content: '"»"',
|
|
522
|
-
},
|
|
523
|
-
'[class~="lead"]': {
|
|
524
|
-
fontWeight: theme('fontWeight.medium'),
|
|
525
|
-
},
|
|
526
|
-
},
|
|
527
|
-
},
|
|
528
|
-
}),
|
|
529
|
-
},
|
|
530
|
-
},
|
|
531
|
-
};
|
|
532
|
-
};
|