@obosbbl/grunnmuren-tailwind 0.2.1 → 0.4.0

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/README.md CHANGED
@@ -26,14 +26,17 @@ module.exports = {
26
26
 
27
27
  // Usage with options
28
28
  module.exports = {
29
- presets: [require('@obosbbl/grunnmuren-tailwind')({ useLegacyFont: true }),
29
+ presets: [require('@obosbbl/grunnmuren-tailwind')({ useLegacyFont: true, fontBasePath: '/mypath/myfonts' }),
30
30
  // content: [ ... ]
31
31
  };
32
32
  ```
33
33
 
34
34
  ### Fonts
35
35
 
36
- The preset includes font declarations. You'll have to setup your app so it serves the necessary [font files](../react/public/fonts/) at the path `/fonts/`. See the [preset implementation](./tailwind-base.cjs).
36
+ The preset includes font declarations.
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).
37
40
 
38
41
  ## Options
39
42
 
@@ -42,3 +45,4 @@ The preset supports the following options:
42
45
  | Name | Default value | Description |
43
46
  | ------------- | ------------- | -------------------------------------------- |
44
47
  | useLegacyFont | `false` | Whether to use the fonts from the old design |
48
+ | fontBasePath | `/fonts` | Path to where the fonts are hosted |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-tailwind",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Grunnmuren Tailwind preset",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
package/tailwind-base.cjs CHANGED
@@ -5,22 +5,22 @@ const gorditaFonts = [
5
5
  {
6
6
  fontWeight: 400,
7
7
  fontStyle: 'normal',
8
- url: '/fonts/gorditaregular-webfont.woff2',
8
+ url: '/gorditaregular-webfont.woff2',
9
9
  },
10
10
  {
11
11
  fontWeight: 400,
12
12
  fontStyle: 'italic',
13
- url: '/fonts/gorditaregularitalic-webfont.woff2',
13
+ url: '/gorditaregularitalic-webfont.woff2',
14
14
  },
15
15
  {
16
16
  fontWeight: 500,
17
17
  fontStyle: 'normal',
18
- url: '/fonts/gorditamedium-webfont.woff2',
18
+ url: '/gorditamedium-webfont.woff2',
19
19
  },
20
20
  {
21
21
  fontWeight: 700,
22
22
  fontStyle: 'normal',
23
- url: '/fonts/gorditabold-webfont.woff2',
23
+ url: '/gorditabold-webfont.woff2',
24
24
  },
25
25
  ];
26
26
 
@@ -28,22 +28,22 @@ const obosFonts = [
28
28
  {
29
29
  fontWeight: 400,
30
30
  fontStyle: 'normal',
31
- url: '/fonts/OBOSText-Regular.woff2',
31
+ url: '/OBOSText-Regular.woff2',
32
32
  },
33
33
  {
34
34
  fontWeight: 400,
35
35
  fontStyle: 'italic',
36
- url: '/fonts/OBOSText-Italic.woff2',
36
+ url: '/OBOSText-Italic.woff2',
37
37
  },
38
38
  {
39
39
  fontWeight: 500,
40
40
  fontStyle: 'normal',
41
- url: '/fonts/OBOSText-Medium.woff2',
41
+ url: '/OBOSText-Medium.woff2',
42
42
  },
43
43
  {
44
44
  fontWeight: 700,
45
45
  fontStyle: 'normal',
46
- url: '/fonts/OBOSText-Bold.woff2',
46
+ url: '/OBOSText-Bold.woff2',
47
47
  },
48
48
  ];
49
49
 
@@ -157,14 +157,26 @@ const snackbar = plugin(function ({ addComponents, theme }) {
157
157
  });
158
158
  });
159
159
 
160
- module.exports = (opts = { useLegacyFont: false }) => {
160
+ const defaultOpts = {
161
+ useLegacyFont: false,
162
+ fontBasePath: '/fonts',
163
+ useLegacyContainerSize: false,
164
+ };
165
+
166
+ module.exports = (userOptions) => {
167
+ const opts = userOptions ? { ...defaultOpts, ...userOptions } : defaultOpts;
161
168
  let fontFamily = 'OBOSFont';
162
169
  let fonts = obosFonts;
170
+ let containerSize = '90rem';
163
171
  if (opts.useLegacyFont) {
164
172
  fontFamily = 'Gordita';
165
173
  fonts = gorditaFonts;
166
174
  }
167
175
 
176
+ if (opts.useLegacyContainerSize) {
177
+ containerSize = '80rem';
178
+ }
179
+
168
180
  return {
169
181
  plugins: [
170
182
  // TODO: Remove the aspect ratio plugin when Safari 14 usage is low enough
@@ -189,6 +201,10 @@ module.exports = (opts = { useLegacyFont: false }) => {
189
201
  '@apply underline': {},
190
202
  },
191
203
  '::selection': { '@apply bg-green-light text-black': {} },
204
+ // Remove the disclosure triangle in Safari if apply the `list-none` utility to the summary element
205
+ 'summary.list-none::-webkit-details-marker': {
206
+ display: 'none',
207
+ },
192
208
  });
193
209
  addComponents({
194
210
  '.container': {
@@ -197,7 +213,7 @@ module.exports = (opts = { useLegacyFont: false }) => {
197
213
  paddingRight: '1rem',
198
214
  marginLeft: 'auto',
199
215
  marginRight: 'auto',
200
- maxWidth: '90rem',
216
+ maxWidth: containerSize,
201
217
  },
202
218
  '.container-prose': {
203
219
  width: '100%',
@@ -245,7 +261,7 @@ module.exports = (opts = { useLegacyFont: false }) => {
245
261
  fontFamily,
246
262
  fontWeight: font.fontWeight,
247
263
  fontStyle: font.fontStyle,
248
- src: `url('${font.url}') format('woff2')`,
264
+ src: `url('${opts.fontBasePath}${font.url}') format('woff2')`,
249
265
  fontDisplay: 'swap',
250
266
  },
251
267
  })),