@x-govuk/govuk-eleventy-plugin 6.7.2 → 7.0.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.
Files changed (98) hide show
  1. package/README.md +8 -6
  2. package/package.json +23 -16
  3. package/{lib/govuk.js → src/application.js} +1 -1
  4. package/src/application.scss +9 -0
  5. package/{lib → src}/collections/all.js +1 -1
  6. package/src/collections/index.js +21 -0
  7. package/{lib → src}/collections/navigation.js +1 -1
  8. package/{lib → src}/collections/sitemap.js +1 -1
  9. package/{lib → src}/collections/tags.js +1 -1
  10. package/src/components/_index.scss +11 -0
  11. package/src/components/aside/_index.scss +21 -0
  12. package/src/components/contents-list/_index.scss +55 -0
  13. package/src/components/definition-list/_index.scss +19 -0
  14. package/src/components/document-header/_index.scss +13 -0
  15. package/src/components/document-list/_index.scss +55 -0
  16. package/{components → src/components}/footer/template.njk +22 -0
  17. package/src/components/footnotes-list/_index.scss +56 -0
  18. package/src/components/header/_index.scss +17 -0
  19. package/{components → src/components}/header/template.njk +19 -5
  20. package/{components/link/_link.scss → src/components/link/_index.scss} +2 -0
  21. package/src/components/prose-scope/_index.scss +157 -0
  22. package/src/components/service-navigation/_index.scss +12 -0
  23. package/src/components/service-navigation/macro.njk +3 -0
  24. package/src/components/service-navigation/template.njk +19 -0
  25. package/src/components/site-search/_index.scss +214 -0
  26. package/{lib → src}/data/eleventy-computed.js +6 -4
  27. package/src/data/options.js +51 -0
  28. package/src/events/generate-govuk-assets.js +57 -0
  29. package/{lib → src}/extensions/scss.js +7 -5
  30. package/{lib → src}/filters/canonical-url.js +2 -2
  31. package/{lib → src}/filters/current-page.js +1 -1
  32. package/{lib → src}/filters/date.js +2 -2
  33. package/{lib → src}/filters/includes.js +3 -2
  34. package/src/filters/index.js +17 -0
  35. package/{lib → src}/filters/items-from-collection.js +2 -2
  36. package/{lib → src}/filters/items-from-navigation.js +6 -2
  37. package/{lib → src}/filters/items-from-pagination.js +1 -1
  38. package/{lib → src}/filters/markdown.js +5 -5
  39. package/{lib → src}/filters/no-orphans.js +2 -2
  40. package/{lib → src}/filters/pretty.js +1 -1
  41. package/src/filters/slice-from-collection.js +18 -0
  42. package/{lib → src}/filters/smart.js +4 -4
  43. package/{lib → src}/filters/tokenize.js +1 -1
  44. package/src/index.js +63 -0
  45. package/src/index.scss +8 -0
  46. package/{layouts → src/layouts}/base.njk +14 -11
  47. package/{layouts → src/layouts}/feed.njk +7 -3
  48. package/src/macros/x-govuk-logo.njk +51 -0
  49. package/{lib → src}/markdown-it/deflist.js +1 -1
  50. package/{lib → src}/markdown-it/footnote.js +1 -1
  51. package/{lib → src}/markdown-it/table-of-contents.js +1 -1
  52. package/{lib → src}/markdown-it/table.js +1 -1
  53. package/src/markdown-it.js +70 -0
  54. package/{lib → src}/nunjucks.js +6 -6
  55. package/src/utils.js +69 -0
  56. package/components/all.scss +0 -10
  57. package/components/aside/_aside.scss +0 -17
  58. package/components/contents-list/_contents-list.scss +0 -51
  59. package/components/definition-list/_definition-list.scss +0 -16
  60. package/components/document-header/_document-header.scss +0 -9
  61. package/components/document-list/_document-list.scss +0 -51
  62. package/components/footnotes-list/_footnotes-list.scss +0 -50
  63. package/components/header/_govuk.svg +0 -4
  64. package/components/header/_header.scss +0 -31
  65. package/components/header/_x-govuk.svg +0 -4
  66. package/components/prose-scope/_prose-scope.scss +0 -153
  67. package/components/site-search/_site-search.scss +0 -206
  68. package/index.js +0 -71
  69. package/lib/collections/index.js +0 -17
  70. package/lib/data/options.js +0 -48
  71. package/lib/events/generate-govuk-assets.js +0 -54
  72. package/lib/govuk.scss +0 -14
  73. package/lib/markdown-it.js +0 -52
  74. package/lib/utils.js +0 -50
  75. /package/{components → src/components}/aside/macro.njk +0 -0
  76. /package/{components → src/components}/aside/template.njk +0 -0
  77. /package/{components → src/components}/document-header/macro.njk +0 -0
  78. /package/{components → src/components}/document-header/template.njk +0 -0
  79. /package/{components → src/components}/document-list/macro.njk +0 -0
  80. /package/{components → src/components}/document-list/template.njk +0 -0
  81. /package/{components → src/components}/footer/_ogl.svg +0 -0
  82. /package/{components → src/components}/footer/macro.njk +0 -0
  83. /package/{components → src/components}/header/macro.njk +0 -0
  84. /package/{components → src/components}/prose-scope/macro.njk +0 -0
  85. /package/{components → src/components}/prose-scope/template.njk +0 -0
  86. /package/{components → src/components}/site-search/macro.njk +0 -0
  87. /package/{components → src/components}/site-search/site-search.js +0 -0
  88. /package/{components → src/components}/site-search/template.njk +0 -0
  89. /package/{layouts → src/layouts}/collection.njk +0 -0
  90. /package/{layouts → src/layouts}/page.njk +0 -0
  91. /package/{layouts → src/layouts}/post.njk +0 -0
  92. /package/{layouts → src/layouts}/product.njk +0 -0
  93. /package/{layouts → src/layouts}/search-index.njk +0 -0
  94. /package/{layouts → src/layouts}/shared/related.njk +0 -0
  95. /package/{layouts → src/layouts}/sitemap.njk +0 -0
  96. /package/{layouts → src/layouts}/sub-navigation.njk +0 -0
  97. /package/{layouts → src/layouts}/tag.njk +0 -0
  98. /package/{layouts → src/layouts}/tags.njk +0 -0
package/README.md CHANGED
@@ -11,8 +11,8 @@ You’re welcome to use the plugin even if your service isn’t considered part
11
11
 
12
12
  ## Requirements
13
13
 
14
- - [Node.js](https://nodejs.org) v18.17 or later
15
- - [Eleventy](https://www.11ty.dev) v2 or later
14
+ - [Node.js](https://nodejs.org) v22 or later
15
+ - [Eleventy](https://www.11ty.dev) v3 or later
16
16
 
17
17
  ## Installation
18
18
 
@@ -21,11 +21,13 @@ You’re welcome to use the plugin even if your service isn’t considered part
21
21
  ## Usage
22
22
 
23
23
  ```js
24
- const govukEleventyPlugin = require('@x-govuk/govuk-eleventy-plugin')
24
+ import { govukEleventyPlugin } from '@x-govuk/govuk-eleventy-plugin'
25
25
 
26
- eleventyConfig.addPlugin(govukEleventyPlugin, {
27
- // Options
28
- })
26
+ export default function(eleventyConfig) {
27
+ eleventyConfig.addPlugin(govukEleventyPlugin, {
28
+ // Options
29
+ })
30
+ }
29
31
  ```
30
32
 
31
33
  Learn more about how to [get started](https://x-govuk.github.io/govuk-eleventy-plugin/get-started/) and which [options you can provide](https://x-govuk.github.io/govuk-eleventy-plugin/options/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-govuk/govuk-eleventy-plugin",
3
- "version": "6.7.2",
3
+ "version": "7.0.0",
4
4
  "description": "Write documentation using Markdown and publish it using GOV.UK styles",
5
5
  "keywords": [
6
6
  "govuk",
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "homepage": "https://x-govuk.github.io/govuk-eleventy-plugin/",
12
12
  "bugs": {
13
- "url": "https://github.com/x-govuk/govuk-eleventy-plugin/issues"
13
+ "url": "git+https://github.com/x-govuk/govuk-eleventy-plugin/issues"
14
14
  },
15
15
  "contributors": [
16
16
  {
@@ -20,19 +20,18 @@
20
20
  ],
21
21
  "license": "MIT",
22
22
  "files": [
23
- "components",
24
- "layouts",
25
- "lib"
23
+ "src"
26
24
  ],
27
- "main": "index.js",
28
- "sass": "lib/govuk.scss",
25
+ "main": "src/index.js",
29
26
  "repository": {
30
27
  "type": "git",
31
28
  "url": "https://github.com/x-govuk/govuk-eleventy-plugin.git"
32
29
  },
33
30
  "scripts": {
34
31
  "prebuild": "rimraf _site",
32
+ "postbuild": "npm run build:example",
35
33
  "build": "eleventy",
34
+ "build:example": "eleventy --config=example.config.js",
36
35
  "predev": "rimraf _site",
37
36
  "dev": "eleventy --serve --watch",
38
37
  "start": "eleventy --serve",
@@ -52,12 +51,13 @@
52
51
  "access": "public"
53
52
  },
54
53
  "dependencies": {
55
- "@11ty/eleventy": "^2.0.0",
56
- "@11ty/eleventy-navigation": "^0.3.2",
57
- "@11ty/eleventy-plugin-rss": "^1.0.0",
54
+ "@11ty/eleventy": "^3.0.0",
55
+ "@11ty/eleventy-navigation": "^1.0.0",
56
+ "@11ty/eleventy-plugin-rss": "^2.0.0",
58
57
  "@rollup/plugin-commonjs": "^28.0.0",
59
58
  "@rollup/plugin-node-resolve": "^16.0.0",
60
- "@x-govuk/govuk-prototype-components": "^3.0.0",
59
+ "@rollup/plugin-terser": "^0.4.4",
60
+ "@x-govuk/govuk-prototype-components": "^4.0.0",
61
61
  "deepmerge": "^4.2.2",
62
62
  "govuk-frontend": "^5.6.0",
63
63
  "luxon": "^3.0.1",
@@ -65,14 +65,14 @@
65
65
  "markdown-it-anchor": "^9.0.0",
66
66
  "markdown-it-deflist": "^3.0.0",
67
67
  "markdown-it-footnote": "^4.0.0",
68
- "markdown-it-govuk": "^0.4.0",
68
+ "markdown-it-govuk": "^0.5.0",
69
69
  "markdown-it-image-figures": "^2.0.0",
70
70
  "markdown-it-ins": "^4.0.0",
71
71
  "markdown-it-mark": "^4.0.0",
72
72
  "markdown-it-sub": "^2.0.0",
73
73
  "markdown-it-sup": "^2.0.0",
74
- "markdown-it-table-of-contents": "^0.8.0",
75
- "rimraf": "^5.0.0",
74
+ "markdown-it-table-of-contents": "^0.9.0",
75
+ "rimraf": "^6.0.0",
76
76
  "rollup": "^4.1.0",
77
77
  "sass": "^1.45.1",
78
78
  "smartypants": "^0.2.0"
@@ -84,9 +84,16 @@
84
84
  "prettier": "^3.1.0",
85
85
  "stylelint": "^16.0.0",
86
86
  "stylelint-config-gds": "^2.0.0",
87
- "stylelint-order": "^6.0.0"
87
+ "stylelint-order": "^7.0.0"
88
88
  },
89
89
  "engines": {
90
- "node": ">=18.17"
90
+ "node": ">=22"
91
+ },
92
+ "type": "module",
93
+ "exports": {
94
+ ".": {
95
+ "sass": "./src/index.scss",
96
+ "import": "./src/index.js"
97
+ }
91
98
  }
92
99
  }
@@ -1,6 +1,6 @@
1
1
  import { initAll as GOVUKFrontend } from 'govuk-frontend'
2
2
 
3
- import { SiteSearchElement } from '../components/site-search/site-search.js'
3
+ import { SiteSearchElement } from './components/site-search/site-search.js'
4
4
 
5
5
  // Initiate custom elements
6
6
  customElements.define('site-search', SiteSearchElement)
@@ -0,0 +1,9 @@
1
+ // GOV.UK Frontend components
2
+ @use "pkg:govuk-frontend/dist/govuk" with (
3
+ $govuk-global-styles: true,
4
+ $govuk-new-organisation-colours: true,
5
+ $govuk-new-typography-scale: true
6
+ );
7
+
8
+ // GOV.UK Eleventy Plugin components
9
+ @forward "pkg:@x-govuk/govuk-eleventy-plugin";
@@ -1,2 +1,2 @@
1
- module.exports = (collection) =>
1
+ export const all = (collection) =>
2
2
  collection.getAllSorted().filter((item) => !item.inputPath.includes('.scss'))
@@ -0,0 +1,21 @@
1
+ export async function addCollections(eleventyConfig) {
2
+ if (!eleventyConfig.collections.all) {
3
+ const { all } = await import('./all.js')
4
+ eleventyConfig.addCollection('all', all)
5
+ }
6
+
7
+ if (!eleventyConfig.collections.navigation) {
8
+ const { navigation } = await import('./navigation.js')
9
+ eleventyConfig.addCollection('navigation', navigation)
10
+ }
11
+
12
+ if (!eleventyConfig.collections.sitemap) {
13
+ const { sitemap } = await import('./sitemap.js')
14
+ eleventyConfig.addCollection('sitemap', sitemap)
15
+ }
16
+
17
+ if (!eleventyConfig.collections.tag) {
18
+ const { tags } = await import('./tags.js')
19
+ eleventyConfig.addCollection('tags', tags)
20
+ }
21
+ }
@@ -1,4 +1,4 @@
1
- module.exports = (collection) =>
1
+ export const navigation = (collection) =>
2
2
  collection
3
3
  .getFilteredByGlob(['**/*.md', '**/*.njk'])
4
4
  .filter((item) => !/^tag/.test(item.data.layout))
@@ -1,4 +1,4 @@
1
- module.exports = (collection) => {
1
+ export const sitemap = (collection) => {
2
2
  return collection.getAllSorted().filter((item) => {
3
3
  // Only return content that was originally a Markdown file
4
4
  const extension = item.inputPath.split('.').pop()
@@ -1,4 +1,4 @@
1
- module.exports = (collection) => {
1
+ export const tags = (collection) => {
2
2
  const items = collection.getAll()
3
3
  let tags = []
4
4
 
@@ -0,0 +1,11 @@
1
+ @forward "aside";
2
+ @forward "contents-list";
3
+ @forward "definition-list";
4
+ @forward "document-header";
5
+ @forward "document-list";
6
+ @forward "footnotes-list";
7
+ @forward "header";
8
+ @forward "link";
9
+ @forward "prose-scope";
10
+ @forward "service-navigation";
11
+ @forward "site-search";
@@ -0,0 +1,21 @@
1
+ @use "govuk-frontend/dist/govuk" as *;
2
+
3
+ @include govuk-exports("govuk-eleventy-plugin/component/aside") {
4
+ .app-aside {
5
+ @include govuk-responsive-margin(6, "bottom");
6
+ @include govuk-text-colour;
7
+ border-top: 2px solid $govuk-brand-colour;
8
+ }
9
+
10
+ .app-aside__heading {
11
+ @include govuk-font(19, $weight: bold);
12
+ margin-bottom: govuk-spacing(2);
13
+ margin-top: govuk-spacing(3);
14
+ }
15
+
16
+ .app-aside__body {
17
+ > * {
18
+ @include govuk-font(16);
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,55 @@
1
+ @use "govuk-frontend/dist/govuk" as *;
2
+
3
+ // Based on the GOV.UK ‘Contents list’ component
4
+ // https://components.publishing.service.gov.uk/component-guide/contents_list
5
+ @include govuk-exports("govuk-eleventy-plugin/component/contents-list") {
6
+ .app-contents-list {
7
+ @include govuk-responsive-margin(8, "bottom");
8
+
9
+ ul {
10
+ list-style-type: none;
11
+ margin-top: 0;
12
+ padding-left: 0;
13
+ }
14
+
15
+ ul ul {
16
+ margin-bottom: 0;
17
+ }
18
+
19
+ li {
20
+ @include govuk-font($size: 16, $weight: bold);
21
+ @include govuk-text-colour;
22
+ padding-top: govuk-spacing(2);
23
+
24
+ @include govuk-media-query($from: tablet) {
25
+ padding-top: govuk-spacing(6) / 4;
26
+ }
27
+ }
28
+
29
+ li li {
30
+ font-weight: normal;
31
+ padding-left: govuk-spacing(5);
32
+ position: relative;
33
+
34
+ &::before {
35
+ content: "—";
36
+ left: 0;
37
+ overflow: hidden;
38
+ position: absolute;
39
+ width: govuk-spacing(4);
40
+ }
41
+ }
42
+
43
+ a {
44
+ @include govuk-link-common;
45
+ @include govuk-link-style-no-visited-state;
46
+ @include govuk-link-style-no-underline;
47
+ }
48
+ }
49
+
50
+ .app-contents-list__title {
51
+ @include govuk-text-colour;
52
+ @include govuk-font($size: 16, $weight: regular, $line-height: 1.5);
53
+ margin: 0;
54
+ }
55
+ }
@@ -0,0 +1,19 @@
1
+ @use "govuk-frontend/dist/govuk" as *;
2
+
3
+ @include govuk-exports("govuk-eleventy-plugin/component/definition-list") {
4
+ .app-definition-list {
5
+ dt {
6
+ @include govuk-font($size: 19, $weight: bold);
7
+ margin-bottom: govuk-spacing(1);
8
+ }
9
+
10
+ dd + dt {
11
+ margin-top: govuk-spacing(4);
12
+ }
13
+
14
+ dd {
15
+ @include govuk-font($size: 19);
16
+ margin-left: govuk-spacing(5);
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,13 @@
1
+ @use "govuk-frontend/dist/govuk" as *;
2
+
3
+ @include govuk-exports("govuk-eleventy-plugin/component/document-header") {
4
+ .app-document-header__metadata {
5
+ @include govuk-font($size: 16, $line-height: 1.5);
6
+ color: $govuk-secondary-text-colour;
7
+ max-width: 45em;
8
+ }
9
+
10
+ .app-document-header__description {
11
+ max-width: 30em;
12
+ }
13
+ }
@@ -0,0 +1,55 @@
1
+ @use "govuk-frontend/dist/govuk" as *;
2
+
3
+ @include govuk-exports("govuk-eleventy-plugin/component/document-list") {
4
+ .app-document-list {
5
+ list-style: none;
6
+ margin: 0;
7
+ padding: 0;
8
+ }
9
+
10
+ .app-document-list__item {
11
+ border-top: 1px solid $govuk-border-colour;
12
+ margin-bottom: govuk-spacing(5);
13
+ padding-top: govuk-spacing(2);
14
+ }
15
+
16
+ .app-document-list__item-title {
17
+ @include govuk-font($size: 19, $weight: "bold");
18
+ margin: 0 0 govuk-spacing(1);
19
+ }
20
+
21
+ .app-document-list__item-metadata {
22
+ margin: 0;
23
+ padding: 0;
24
+ }
25
+
26
+ .app-document-list__item-description {
27
+ @include govuk-font($size: 16);
28
+ margin: govuk-spacing(1) 0;
29
+ }
30
+
31
+ .app-document-list__attribute {
32
+ @include govuk-font($size: 16);
33
+ color: $govuk-secondary-text-colour;
34
+ display: inline-block;
35
+ margin: 0;
36
+
37
+ & + .app-document-list__attribute::before {
38
+ content: "\2002•\2002";
39
+ }
40
+ }
41
+
42
+ .app-document-list--large {
43
+ .app-document-list__item-title {
44
+ @include govuk-font($size: 24, $weight: "bold");
45
+ }
46
+
47
+ .app-document-list__item-description {
48
+ @include govuk-font($size: 19);
49
+ }
50
+
51
+ .app-document-list__attribute {
52
+ @include govuk-font($size: 16);
53
+ }
54
+ }
55
+ }
@@ -1,5 +1,27 @@
1
+ {% from "macros/x-govuk-logo.njk" import xGovukLogo -%}
2
+ {% from "govuk/macros/logo.njk" import govukLogo -%}
3
+
4
+ {%- set _rebrand = params.rebrand | default(govukRebrand() if govukRebrand is callable else govukRebrand) -%}
5
+
1
6
  <footer class="govuk-footer app-footer {{ params.classes if params.classes }}" role="contentinfo"{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
2
7
  <div class="govuk-width-container {{ params.containerClasses if params.containerClasses }}">
8
+ {% if xGovuk %}
9
+ {{ xGovukLogo({
10
+ classes: "govuk-footer__crown x-govuk-footer__crown",
11
+ attributes: {
12
+ width: "45",
13
+ height: "45"
14
+ },
15
+ useCrown: true,
16
+ useLogotype: false
17
+ }) | trim | indent(10) }}
18
+ {% elif _rebrand and params.logo != false %}
19
+ {{- govukLogo({
20
+ classes: "govuk-footer__crown",
21
+ rebrand: true,
22
+ useLogotype: false
23
+ }) }}
24
+ {% endif %}
3
25
  {% if params.navigation | length %}
4
26
  <div class="govuk-footer__navigation">
5
27
  {% for nav in params.navigation %}
@@ -0,0 +1,56 @@
1
+ @use "govuk-frontend/dist/govuk" as *;
2
+
3
+ @include govuk-exports("govuk-eleventy-plugin/component/footnotes-list") {
4
+ // Link to footnote
5
+ a[aria-describedby="footnotes-label"] {
6
+ @include govuk-font(16, $tabular: true);
7
+ @include govuk-link-style-no-visited-state;
8
+ }
9
+
10
+ a[aria-describedby="footnotes-label"]::before {
11
+ color: currentcolor;
12
+ content: "[";
13
+ }
14
+
15
+ a[aria-describedby="footnotes-label"]::after {
16
+ color: currentcolor;
17
+ content: "]";
18
+ }
19
+
20
+ // Footnotes
21
+ .app-footnotes-list {
22
+ @include govuk-font($size: 19);
23
+ counter-reset: footnotes;
24
+ list-style-type: none;
25
+ padding-left: 0;
26
+
27
+ li {
28
+ counter-increment: footnotes;
29
+ padding: govuk-spacing(3);
30
+ padding-left: govuk-spacing(8);
31
+ position: relative;
32
+ }
33
+
34
+ li::before {
35
+ @include govuk-font(19, $tabular: true);
36
+ content: counter(footnotes) ".";
37
+ left: govuk-spacing(4);
38
+ position: absolute;
39
+ }
40
+
41
+ a[aria-label="Back to content"] {
42
+ @include govuk-link-style-no-visited-state;
43
+ position: relative;
44
+ text-underline-offset: 0;
45
+ top: 2px;
46
+ }
47
+
48
+ :target {
49
+ background-color: govuk-tint($govuk-focus-colour, 75%);
50
+ }
51
+
52
+ :last-child {
53
+ margin-bottom: 0;
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,17 @@
1
+ @use "govuk-frontend/dist/govuk" as *;
2
+
3
+ @include govuk-exports("govuk-eleventy-plugin/component/header") {
4
+ .app-header__container {
5
+ align-items: center;
6
+ display: flex;
7
+ flex-wrap: wrap;
8
+ }
9
+
10
+ .app-header__logo {
11
+ width: auto;
12
+ }
13
+
14
+ .app-header--no-border {
15
+ border-bottom: 0;
16
+ }
17
+ }
@@ -1,21 +1,35 @@
1
- {%- from "components/site-search/macro.njk" import appSiteSearch with context -%}
2
- {%- if options.navigation -%}
1
+ {% from "components/site-search/macro.njk" import appSiteSearch with context -%}
2
+ {% from "macros/x-govuk-logo.njk" import xGovukLogo -%}
3
+ {% from "govuk/macros/logo.njk" import govukLogo -%}
4
+
5
+ {%- set _rebrand = params.rebrand | default(govukRebrand() if govukRebrand is callable else govukRebrand) -%}
6
+
7
+ {%- if options.serviceNavigation -%}
3
8
  {%- set headerClasses = " govuk-header--full-width-border" -%}
4
9
  {% elif layout == "product" or layout == "collection" %}
5
10
  {%- set headerClasses = " app-header--no-border" -%}
6
11
  {%- endif -%}
12
+
7
13
  <header class="govuk-header app-header{{ headerClasses }}" role="banner" data-module="govuk-header">
8
14
  <div class="govuk-header__container govuk-width-container app-header__container">
9
15
  <div class="govuk-header__logo app-header__logo">
10
16
  <a href="{{ params.homepageUrl | default("/") }}" class="govuk-header__link govuk-header__link--homepage">
11
- {% if params.logotype == "x-govuk" %}
12
- {% include "./_x-govuk.svg" %}
17
+ {% if xGovuk %}
18
+ {{ xGovukLogo({
19
+ classes: "govuk-header__logotype x-govuk-header__logotype",
20
+ ariaLabelText: "X-GOVUK"
21
+ }) | trim | indent(10) }}
13
22
  {% elif params.logotype.html %}
14
23
  {{ params.logotype.html }}
15
24
  {% elif params.logotype.text %}
16
25
  <span class="app-header__logotype">{{ params.logotype.text }}</span>
17
26
  {% else %}
18
- {% include "./_govuk.svg" %}
27
+ {{ govukLogo({
28
+ classes: "govuk-header__logotype",
29
+ ariaLabelText: "GOV.UK",
30
+ useTudorCrown: params.useTudorCrown,
31
+ rebrand: _rebrand
32
+ }) | trim | indent(10) }}
19
33
  {% endif %}
20
34
  {% if params.productName %}
21
35
  <span class="govuk-header__product-name">
@@ -1,3 +1,5 @@
1
+ @use "govuk-frontend/dist/govuk" as *;
2
+
1
3
  .govuk-link.app-link--heading {
2
4
  @include govuk-link-style-text;
3
5
  @include govuk-link-style-no-underline;
@@ -0,0 +1,157 @@
1
+ @use "govuk-frontend/dist/govuk" as *;
2
+
3
+ @include govuk-exports("govuk-eleventy-plugin/component/prose-scope") {
4
+ .app-prose-scope {
5
+ @include govuk-responsive-margin(8, "bottom");
6
+
7
+ > *:first-child {
8
+ margin-top: 0;
9
+ }
10
+
11
+ > *:last-child {
12
+ margin-bottom: 0;
13
+ }
14
+
15
+ h1 {
16
+ max-width: 15em;
17
+ }
18
+
19
+ h2 {
20
+ max-width: 20em;
21
+ }
22
+
23
+ h3 {
24
+ max-width: 30em;
25
+ }
26
+
27
+ h4,
28
+ h5,
29
+ h6,
30
+ p,
31
+ ul:not([class]),
32
+ ol,
33
+ img,
34
+ video {
35
+ max-width: 38em;
36
+ }
37
+
38
+ // Indicate abbreviations which have a title
39
+ abbr {
40
+ border-bottom: 1px dotted $govuk-secondary-text-colour;
41
+ cursor: help;
42
+ }
43
+
44
+ // Distinguish inserted text from that inside links
45
+ ins {
46
+ text-decoration-style: double;
47
+ }
48
+
49
+ // Use GOV.UK yellow colour for highlighted text
50
+ mark {
51
+ background-color: govuk-tint($govuk-focus-colour, 50%);
52
+ }
53
+
54
+ // Ensure sub- and superscript text doesn’t disrupt vertical rhythm
55
+ sub,
56
+ sup {
57
+ line-height: 0;
58
+ position: relative;
59
+ vertical-align: baseline;
60
+ }
61
+
62
+ sup {
63
+ top: -0.4em;
64
+ }
65
+
66
+ sub {
67
+ bottom: -0.4em;
68
+ }
69
+
70
+ img {
71
+ height: auto;
72
+ max-width: 100%;
73
+ width: auto;
74
+ }
75
+
76
+ figure {
77
+ @include govuk-responsive-margin(6, "bottom");
78
+ margin-left: 0;
79
+ margin-right: 0;
80
+ width: 100%;
81
+
82
+ // Show outline around linked images within figures
83
+ img {
84
+ display: block;
85
+ outline: 1px solid rgba($govuk-border-colour, 0.5);
86
+ }
87
+
88
+ > .govuk-link img {
89
+ &:hover {
90
+ outline-color: $govuk-link-hover-colour;
91
+ }
92
+
93
+ &:active {
94
+ outline-color: $govuk-link-active-colour;
95
+ }
96
+ }
97
+
98
+ :focus & {
99
+ background-color: $govuk-focus-colour;
100
+ }
101
+ }
102
+
103
+ figcaption {
104
+ @include govuk-font($size: 19);
105
+ color: $govuk-secondary-text-colour;
106
+ margin-top: govuk-spacing(1);
107
+ }
108
+
109
+ // Responsive tables
110
+ .govuk-table[tabindex] {
111
+ display: block;
112
+ overflow-x: auto;
113
+ scrollbar-color: $govuk-border-colour govuk-colour("light-grey");
114
+
115
+ &::-webkit-scrollbar {
116
+ height: govuk-spacing(1);
117
+ width: govuk-spacing(1);
118
+ }
119
+
120
+ &::-webkit-scrollbar-thumb {
121
+ background: $govuk-border-colour;
122
+ }
123
+
124
+ &:focus {
125
+ box-shadow:
126
+ 0 0 0 #{$govuk-focus-width * 3} govuk-colour("black"),
127
+ 0 0 0 #{$govuk-focus-width * 4} $govuk-focus-colour;
128
+ outline: #{$govuk-focus-width * 2} solid govuk-colour("white");
129
+ }
130
+
131
+ &:focus:not(:focus-visible) {
132
+ box-shadow: none;
133
+ outline: none;
134
+ }
135
+
136
+ &:focus-visible {
137
+ box-shadow:
138
+ 0 0 0 #{$govuk-focus-width * 3} govuk-colour("black"),
139
+ 0 0 0 #{$govuk-focus-width * 4} $govuk-focus-colour;
140
+ outline: #{$govuk-focus-width * 2} solid govuk-colour("white");
141
+ }
142
+ }
143
+
144
+ // Reverse the colour of code that uses shell highlighting
145
+ .x-govuk-code__language--shell {
146
+ background-color: govuk-colour("black");
147
+ border: $govuk-focus-width solid govuk-colour("white");
148
+ -webkit-font-smoothing: auto;
149
+ margin-left: $govuk-focus-width * -1;
150
+ margin-right: $govuk-focus-width * -1;
151
+
152
+ code {
153
+ filter: invert(100%);
154
+ }
155
+ }
156
+ }
157
+ }