@conduction/docusaurus-preset 1.1.1 → 1.2.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
@@ -11,7 +11,7 @@ Source lives inside the [design-system monorepo](https://github.com/ConductionNL
11
11
  - **Brand CSS** — tokens (cobalt palette, KNVB orange, Plex Mono, hex clip-paths, Common Ground yellow) auto-applied to Docusaurus's Infima theme variables. Navbar, footer, sidebar, buttons, code blocks all inherit the brand without a single swizzle.
12
12
  - **i18n config** — four locales pinned: NL default at the URL root, EN/DE/FR at `/en/`, `/de/`, `/fr/`. `htmlLang` per locale, `trailingSlash: true`, locale dropdown ready.
13
13
  - **Brand-default navbar** — locale-dropdown + GitHub link. Sites override `items[]` for site-specific navigation.
14
- - **Brand-default footer** — three-column link grid + Conduction-tells (KvK, BTW, address). Sites override per page or globally.
14
+ - **Brand-default footer** — three-column link grid + Conduction-tells (KvK, BTW, address). Per-property override: pass `footer: { links: [...] }` to swap columns and inherit the brand copyright unchanged. Spread `baseFooterLinks()` to keep one or two brand columns alongside site-specific ones.
15
15
  - **Sensible defaults** — `trailingSlash`, `onBrokenLinks: 'warn'`, `respectPrefersColorScheme`, dark-mode brand mapping.
16
16
 
17
17
  ## Usage
@@ -59,7 +59,7 @@ The function returns a complete Docusaurus config with brand defaults pre-applie
59
59
  | `projectName` | | `'design-system'` | GitHub repo. |
60
60
  | `i18n` | | nl / en / de / fr, NL default | Override the brand-default i18n block. |
61
61
  | `navbar` | | locale dropdown + GitHub | Merged into the brand-default navbar object. |
62
- | `footer` | | three-column link grid | Replaces the brand-default footer. |
62
+ | `footer` | | three-column link grid + KvK/BTW copyright | Per-property fallback: any of `style` / `links` / `copyright` you omit keeps the brand default. Pass `footer: { links: [...] }` to swap columns and inherit the brand copyright. |
63
63
  | `customCss` | | `[]` | Site-specific CSS, appended to `brand.css`. |
64
64
  | `presets` | | `[['classic', …]]` | Replaces the default preset list. |
65
65
  | `plugins` | | `[]` | Docusaurus plugins. |
@@ -67,7 +67,23 @@ The function returns a complete Docusaurus config with brand defaults pre-applie
67
67
  | `editUrl` | | undefined | Edit-this-doc link. |
68
68
  | `blog` | | enabled | Set `false` to disable the blog plugin. |
69
69
 
70
- Also exported: `I18N`, `baseNavbar(siteName)`, `baseFooter()` for sites that want to compose manually.
70
+ Also exported: `I18N`, `baseNavbar(siteName)`, `baseFooter()`, `baseFooterLinks()`, `baseFooterCopyright()` for sites that want to compose manually. Common pattern on a product page: pass site-specific columns plus the Conduction column from the brand default:
71
+
72
+ ```js
73
+ const { createConfig, baseFooterLinks } = require('@conduction/docusaurus-preset');
74
+
75
+ module.exports = createConfig({
76
+ // …
77
+ footer: {
78
+ links: [
79
+ { title: 'MyProduct', items: [/* …site links */] },
80
+ // Spread the brand "Conduction" column to keep the corporate anchor.
81
+ ...baseFooterLinks().filter((c) => c.title === 'Conduction'),
82
+ ],
83
+ // copyright: omitted -> brand KvK/BTW/IBAN inherits.
84
+ },
85
+ });
86
+ ```
71
87
 
72
88
  ## Brand CSS exports
73
89
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/docusaurus-preset",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Conduction brand preset for Docusaurus 3. Tokens, theme, navbar, footer, i18n config for nl/en/de/fr, and the React component library that powers conduction.nl and the Conduction product sites.",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -8,7 +8,7 @@
8
8
  border: 1px solid var(--c-cobalt-100);
9
9
  border-radius: var(--radius-lg);
10
10
  padding: var(--space-7) var(--space-8);
11
- margin: var(--space-10) 0 var(--space-6);
11
+ margin: var(--space-12) 0 var(--space-8);
12
12
  overflow: hidden;
13
13
  font-family: var(--conduction-typography-font-family-body);
14
14
  }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * <Outcomes /> + <Outcome />
3
+ *
4
+ * Sibling to <Prerequisites />, intended for the *top* of academy
5
+ * tutorials. Lists the concrete things the reader will have built,
6
+ * learned, or achieved by the end of the tutorial. Goes right after
7
+ * the lede paragraph and before <Prerequisites />, so the reader
8
+ * scans:
9
+ * - "What am I going to walk away with?" (Outcomes)
10
+ * - "What do I need before I start?" (Prerequisites)
11
+ * - the actual tutorial body
12
+ *
13
+ * Visual: tinted card identical to <Prerequisites />, but each item
14
+ * uses an orange checkmark glyph (achievement) instead of the orange
15
+ * hex bullet (need). Same tone, distinct semantics.
16
+ *
17
+ * Usage:
18
+ *
19
+ * <Outcomes title="Wat je leert">
20
+ * <Outcome>Hoe je het canonieke Woo-register importeert</Outcome>
21
+ * <Outcome>Hoe je een publicatie aanmaakt en koppelt aan een TOOI-categorie</Outcome>
22
+ * <Outcome>Welke API-aanroepen hoort bij elk van de stappen</Outcome>
23
+ * </Outcomes>
24
+ *
25
+ * Mirrors the .outcomes section in
26
+ * preview/components/outcomes.html.
27
+ */
28
+
29
+ import React from 'react';
30
+ import styles from './Outcomes.module.css';
31
+
32
+ export function Outcome({children, className}) {
33
+ const composed = [styles.item, className].filter(Boolean).join(' ');
34
+ return (
35
+ <li className={composed}>
36
+ <svg className={styles.check} viewBox="0 0 24 24" aria-hidden="true"
37
+ fill="none" stroke="currentColor" strokeWidth="3"
38
+ strokeLinecap="round" strokeLinejoin="round">
39
+ <path d="M5 13l4 4L19 7"/>
40
+ </svg>
41
+ <span className={styles.body}>{children}</span>
42
+ </li>
43
+ );
44
+ }
45
+
46
+ export default function Outcomes({title = "What you'll learn", children, className}) {
47
+ const composed = [styles.card, className].filter(Boolean).join(' ');
48
+ return (
49
+ <aside className={composed}>
50
+ {title && <h2 className={styles.title}>{title}</h2>}
51
+ <ul className={styles.list}>{children}</ul>
52
+ </aside>
53
+ );
54
+ }
@@ -0,0 +1,64 @@
1
+ .card {
2
+ background: var(--c-cobalt-50);
3
+ border: 1px solid var(--c-cobalt-100);
4
+ border-radius: var(--radius-lg);
5
+ padding: var(--space-6) var(--space-7);
6
+ margin: var(--space-8) 0;
7
+ font-family: var(--conduction-typography-font-family-body);
8
+ }
9
+
10
+ .title {
11
+ font-size: 22px;
12
+ font-weight: 700;
13
+ letter-spacing: -0.01em;
14
+ color: var(--c-cobalt-900);
15
+ margin: 0 0 var(--space-4);
16
+ line-height: 1.25;
17
+ }
18
+
19
+ .list {
20
+ list-style: none;
21
+ padding: 0;
22
+ margin: 0;
23
+ display: grid;
24
+ gap: var(--space-3);
25
+ max-width: none;
26
+ }
27
+
28
+ .item {
29
+ display: grid;
30
+ grid-template-columns: 22px 1fr;
31
+ gap: var(--space-3);
32
+ align-items: start;
33
+ font-size: 16px;
34
+ line-height: 1.55;
35
+ color: var(--c-cobalt-700);
36
+ }
37
+
38
+ .check {
39
+ width: 22px;
40
+ height: 22px;
41
+ margin-top: 2px;
42
+ color: var(--c-orange-knvb);
43
+ flex-shrink: 0;
44
+ }
45
+
46
+ .body {
47
+ display: block;
48
+ }
49
+
50
+ .body a {
51
+ color: var(--c-blue-cobalt);
52
+ text-decoration: underline;
53
+ text-underline-offset: 2px;
54
+ }
55
+ .body a:hover { color: var(--c-cobalt-900); }
56
+
57
+ .body code {
58
+ background: var(--c-cobalt-100);
59
+ border-radius: 4px;
60
+ padding: 1px 6px;
61
+ font-family: var(--conduction-typography-font-family-code);
62
+ font-size: 14px;
63
+ color: var(--c-cobalt-900);
64
+ }
@@ -3,7 +3,7 @@
3
3
  border: 1px solid var(--c-cobalt-100);
4
4
  border-radius: var(--radius-lg);
5
5
  padding: var(--space-6) var(--space-7);
6
- margin: var(--space-6) 0;
6
+ margin: var(--space-10) 0;
7
7
  font-family: var(--conduction-typography-font-family-body);
8
8
  }
9
9
 
@@ -38,7 +38,7 @@
38
38
  width: 14px;
39
39
  height: 14px;
40
40
  margin-top: 6px;
41
- background: var(--c-cobalt-700);
41
+ background: var(--c-orange-knvb);
42
42
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
43
43
  flex-shrink: 0;
44
44
  }
@@ -99,6 +99,7 @@ export {default as ContentDetailHero} from './ContentDetailHero/ContentDetailHer
99
99
  "What you need", "Troubleshooting", and "Next steps" h2 + bullet
100
100
  patterns that academy tutorials kept duplicating. Designed for use
101
101
  inside an MDX academy post body. */
102
+ export {default as Outcomes, Outcome} from './Outcomes/Outcomes.jsx';
102
103
  export {default as Prerequisites, PrerequisiteItem} from './Prerequisites/Prerequisites.jsx';
103
104
  export {default as Troubleshooting, TroubleshootingItem} from './Troubleshooting/Troubleshooting.jsx';
104
105
  export {default as NextSteps, NextStep} from './NextSteps/NextSteps.jsx';
package/src/index.js CHANGED
@@ -54,39 +54,64 @@ const baseNavbar = (siteName) => ({
54
54
  });
55
55
 
56
56
  /**
57
- * Brand-default footer. Cobalt-900 panel with three-column link grid +
58
- * the standard Conduction tells (KvK, BTW, EUPL/MIT licence).
57
+ * Brand-default footer columns (the "links" array).
58
+ *
59
+ * Three corporate columns rendered on the cobalt-900 footer panel.
60
+ * Sites override these wholesale by passing `footer.links` to
61
+ * createConfig(); a site that wants to keep just one brand column
62
+ * (e.g. only "Conduction" on a product-page footer) can spread the
63
+ * filtered output of this function into their own array. The other
64
+ * footer fields (style, copyright) keep their brand defaults
65
+ * independently.
66
+ */
67
+ const baseFooterLinks = () => [
68
+ {
69
+ title: 'Product',
70
+ items: [
71
+ { label: 'ConNext', href: 'https://conduction.nl/connext' },
72
+ { label: 'Common Ground', href: 'https://conduction.nl/commonground' },
73
+ { label: 'App store', href: 'https://apps.conduction.nl/' },
74
+ { label: 'Common Ground hosting', href: 'https://commonground.nu/' },
75
+ ],
76
+ },
77
+ {
78
+ title: 'Conduction',
79
+ items: [
80
+ { label: 'About', href: 'https://conduction.nl/about' },
81
+ { label: 'Open source', href: 'https://conduction.nl/about#opensource' },
82
+ { label: 'Team', href: 'https://conduction.nl/about#team' },
83
+ { label: 'ISO', href: 'https://conduction.nl/iso' },
84
+ ],
85
+ },
86
+ {
87
+ title: 'Documentatie',
88
+ items: [
89
+ { label: 'Brand book', href: 'https://connext.conduction.nl/' },
90
+ { label: 'Diagram set', href: 'https://connext.conduction.nl/diagrams/' },
91
+ ],
92
+ },
93
+ ];
94
+
95
+ /**
96
+ * Brand-default footer copyright string. KvK + BTW + IBAN + address are
97
+ * the legal anchor that every Conduction-branded site needs to render
98
+ * regardless of which product-specific columns the footer shows above
99
+ * it. Sites override this only for non-Conduction surfaces (rare); on
100
+ * product pages it inherits unchanged.
101
+ */
102
+ const baseFooterCopyright = () =>
103
+ `Conduction B.V. · KvK 76741850 · BTW NL860784241B01 · IBAN NL51 ABNA 0868951550 · Lauriergracht 14h, 1016 RR Amsterdam · ${new Date().getFullYear()}`;
104
+
105
+ /**
106
+ * Brand-default footer (full object). Backward-compatible shim for
107
+ * older sites that called `baseFooter()` directly; new callers should
108
+ * compose with `baseFooterLinks` / `baseFooterCopyright` so per-property
109
+ * overrides keep working.
59
110
  */
60
111
  const baseFooter = () => ({
61
112
  style: 'dark',
62
- links: [
63
- {
64
- title: 'Product',
65
- items: [
66
- { label: 'ConNext', href: 'https://conduction.nl/connext' },
67
- { label: 'Common Ground', href: 'https://conduction.nl/commonground' },
68
- { label: 'App store', href: 'https://apps.conduction.nl/' },
69
- { label: 'Common Ground hosting', href: 'https://commonground.nu/' },
70
- ],
71
- },
72
- {
73
- title: 'Conduction',
74
- items: [
75
- { label: 'About', href: 'https://conduction.nl/about' },
76
- { label: 'Open source', href: 'https://conduction.nl/about#opensource' },
77
- { label: 'Team', href: 'https://conduction.nl/about#team' },
78
- { label: 'ISO', href: 'https://conduction.nl/iso' },
79
- ],
80
- },
81
- {
82
- title: 'Documentatie',
83
- items: [
84
- { label: 'Brand book', href: 'https://connext.conduction.nl/' },
85
- { label: 'Diagram set', href: 'https://connext.conduction.nl/diagrams/' },
86
- ],
87
- },
88
- ],
89
- copyright: `Conduction B.V. · KvK 76741850 · BTW NL860784241B01 · IBAN NL51 ABNA 0868951550 · Lauriergracht 14h, 1016 RR Amsterdam · ${new Date().getFullYear()}`,
113
+ links: baseFooterLinks(),
114
+ copyright: baseFooterCopyright(),
90
115
  });
91
116
 
92
117
  /**
@@ -97,8 +122,11 @@ const baseFooter = () => ({
97
122
  *
98
123
  * Optional:
99
124
  * organizationName, projectName, navbar (deep-merged into base),
100
- * footer (replaces base), customCss[] (appended to brand.css),
101
- * plugins[], presets, i18n (overrides defaults)
125
+ * footer (per-property fallback: any of style/links/copyright the
126
+ * site omits keeps its brand default — pass `footer: { links: [...] }`
127
+ * to swap columns while inheriting the KvK/BTW copyright),
128
+ * customCss[] (appended to brand.css), plugins[], presets,
129
+ * i18n (overrides defaults)
102
130
  */
103
131
  function createConfig(opts) {
104
132
  if (!opts || !opts.title || !opts.url) {
@@ -171,7 +199,19 @@ function createConfig(opts) {
171
199
  respectPrefersColorScheme: true,
172
200
  },
173
201
  navbar: Object.assign(baseNavbar(opts.title), opts.navbar || {}),
174
- footer: opts.footer || baseFooter(),
202
+ /* Per-property fallback so a site can override one slice of the
203
+ footer (e.g. just `links`) and inherit the rest from the brand.
204
+ Previously `opts.footer` replaced the whole footer wholesale,
205
+ which forced sites to copy the KvK/BTW copyright string just to
206
+ swap columns. */
207
+ footer: (() => {
208
+ const f = opts.footer || {};
209
+ return {
210
+ style: f.style || 'dark',
211
+ links: f.links || baseFooterLinks(),
212
+ copyright: f.copyright || baseFooterCopyright(),
213
+ };
214
+ })(),
175
215
  },
176
216
  opts.themeConfig || {}
177
217
  ),
@@ -180,4 +220,11 @@ function createConfig(opts) {
180
220
  };
181
221
  }
182
222
 
183
- module.exports = { createConfig, I18N, baseNavbar, baseFooter };
223
+ module.exports = {
224
+ createConfig,
225
+ I18N,
226
+ baseNavbar,
227
+ baseFooter,
228
+ baseFooterLinks,
229
+ baseFooterCopyright,
230
+ };