@defra/docusaurus-theme-govuk 0.0.14-alpha → 0.0.16-alpha
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra/docusaurus-theme-govuk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16-alpha",
|
|
4
4
|
"description": "A Docusaurus theme implementing the GOV.UK Design System for consistent, accessible documentation sites",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "MIT",
|
package/src/css/components.scss
CHANGED
|
@@ -17,6 +17,16 @@
|
|
|
17
17
|
// Always reserve the scrollbar gutter so expanding subnav items don't
|
|
18
18
|
// cause a horizontal layout shift when the scrollbar appears.
|
|
19
19
|
scrollbar-gutter: stable;
|
|
20
|
+
|
|
21
|
+
// Remove side bar top border
|
|
22
|
+
padding-top: 0;
|
|
23
|
+
border: 0;
|
|
24
|
+
|
|
25
|
+
@media (min-width: 48.125em) {
|
|
26
|
+
overflow: auto !important;
|
|
27
|
+
margin-left: -16px;
|
|
28
|
+
padding-left: 16px;
|
|
29
|
+
}
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
.app-layout-sidebar__content {
|
|
@@ -81,23 +91,24 @@
|
|
|
81
91
|
}
|
|
82
92
|
}
|
|
83
93
|
|
|
84
|
-
// Remove side bar top border
|
|
85
|
-
.app-layout-sidebar__nav {
|
|
86
|
-
overflow: auto;
|
|
87
|
-
padding-top: 0;
|
|
88
|
-
border: 0;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
94
|
// Navigation menu mobile styling
|
|
92
95
|
.app-layout-sidebar__nav .not-govuk-navigation-menu__list > .not-govuk-navigation-menu__list__item {
|
|
93
96
|
border-bottom: 1px solid #cecece;
|
|
97
|
+
|
|
98
|
+
position: relative;
|
|
94
99
|
padding-top: 5px;
|
|
95
100
|
padding-bottom: 5px;
|
|
96
101
|
margin-bottom: 5px;
|
|
97
102
|
font-size: 1rem;
|
|
103
|
+
padding-left: 0;
|
|
104
|
+
margin-left: 0;
|
|
98
105
|
|
|
99
|
-
@media (min-width:
|
|
106
|
+
@media (min-width: 48.125em) {
|
|
100
107
|
border-bottom: 0;
|
|
108
|
+
|
|
109
|
+
&:after {
|
|
110
|
+
border-bottom: 0;
|
|
111
|
+
}
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
.not-govuk-navigation-menu__list__link {
|
|
@@ -106,15 +117,19 @@
|
|
|
106
117
|
}
|
|
107
118
|
|
|
108
119
|
&--active {
|
|
109
|
-
border-left:
|
|
110
|
-
|
|
111
|
-
|
|
120
|
+
border-left: none;
|
|
121
|
+
|
|
122
|
+
@media (min-width: 48.125em) {
|
|
123
|
+
border-left: 4px solid #1d70b8;
|
|
124
|
+
padding-left: 11px;
|
|
125
|
+
margin-left: -15px;
|
|
126
|
+
border-bottom: 0;
|
|
127
|
+
font-weight: bold;
|
|
128
|
+
}
|
|
112
129
|
}
|
|
113
130
|
}
|
|
114
131
|
|
|
115
132
|
// Active indicator on sub-items.
|
|
116
|
-
// __subitems has padding-left: 15px; margin-left: -15px shifts the item back
|
|
117
|
-
// to the container edge so the 4px border sits flush on the left.
|
|
118
133
|
|
|
119
134
|
.app-layout-sidebar__nav .not-govuk-navigation-menu__list__subitems {
|
|
120
135
|
|
|
@@ -126,12 +141,16 @@
|
|
|
126
141
|
}
|
|
127
142
|
|
|
128
143
|
.not-govuk-navigation-menu__list__item--active {
|
|
129
|
-
border-left
|
|
130
|
-
padding-left: 11px;
|
|
131
|
-
font-weight: bold;
|
|
144
|
+
border-left: none;
|
|
132
145
|
|
|
133
|
-
|
|
146
|
+
@media (min-width: 48.125em) {
|
|
147
|
+
border-left: 4px solid #1d70b8;
|
|
148
|
+
padding-left: 10px;
|
|
134
149
|
font-weight: bold;
|
|
150
|
+
|
|
151
|
+
.not-govuk-navigation-menu__list__link {
|
|
152
|
+
font-weight: bold;
|
|
153
|
+
}
|
|
135
154
|
}
|
|
136
155
|
}
|
|
137
156
|
|
|
@@ -155,9 +174,8 @@
|
|
|
155
174
|
|
|
156
175
|
// Mobile: headings become toggle buttons
|
|
157
176
|
.not-govuk-navigation-menu__list__heading-toggle {
|
|
158
|
-
display: flex;
|
|
177
|
+
display: inline-flex;
|
|
159
178
|
align-items: center;
|
|
160
|
-
width: 100%;
|
|
161
179
|
padding: 2px 0;
|
|
162
180
|
background: none;
|
|
163
181
|
border: none;
|
|
@@ -168,29 +186,27 @@
|
|
|
168
186
|
color: #1d70b8;
|
|
169
187
|
cursor: pointer;
|
|
170
188
|
|
|
171
|
-
// Chevron indicator on the
|
|
172
|
-
&::
|
|
189
|
+
// Chevron indicator on the right, pointing down (collapsed)
|
|
190
|
+
&::after {
|
|
173
191
|
content: '';
|
|
174
192
|
display: inline-block;
|
|
175
193
|
width: 0;
|
|
176
194
|
height: 0;
|
|
177
|
-
border-
|
|
178
|
-
border-
|
|
179
|
-
border-
|
|
195
|
+
border-left: 4px solid transparent;
|
|
196
|
+
border-right: 4px solid transparent;
|
|
197
|
+
border-top: 5px solid currentColor;
|
|
180
198
|
flex-shrink: 0;
|
|
181
|
-
margin-
|
|
182
|
-
transition: transform 0.2s ease;
|
|
199
|
+
margin-left: 8px;
|
|
183
200
|
}
|
|
184
201
|
|
|
185
|
-
&[aria-expanded="true"]::
|
|
186
|
-
transform: rotate(
|
|
202
|
+
&[aria-expanded="true"]::after {
|
|
203
|
+
transform: rotate(180deg);
|
|
187
204
|
}
|
|
188
205
|
|
|
189
206
|
&:focus {
|
|
190
|
-
outline: 3px solid
|
|
191
|
-
outline-offset: 0;
|
|
192
|
-
background-color: #fd0;
|
|
207
|
+
outline: 3px solid transparent;
|
|
193
208
|
color: #0b0c0c;
|
|
209
|
+
background-color: #fd0;
|
|
194
210
|
box-shadow: 0 -2px #fd0, 0 4px #0b0c0c;
|
|
195
211
|
}
|
|
196
212
|
}
|
|
@@ -418,7 +434,7 @@
|
|
|
418
434
|
}
|
|
419
435
|
}
|
|
420
436
|
|
|
421
|
-
@media (max-width:
|
|
437
|
+
@media (max-width: 769px) {
|
|
422
438
|
.govuk-header__container {
|
|
423
439
|
flex-direction: column;
|
|
424
440
|
align-items: flex-start;
|
|
@@ -273,7 +273,7 @@ export default function Layout(props) {
|
|
|
273
273
|
<div className="app-masthead">
|
|
274
274
|
<div className="govuk-width-container app-masthead__container">
|
|
275
275
|
<div className="govuk-grid-row">
|
|
276
|
-
<div className="govuk-grid-column-two-thirds">
|
|
276
|
+
<div className="govuk-grid-column-two-thirds-from-desktop">
|
|
277
277
|
<h1 className="govuk-heading-xl app-masthead__title">
|
|
278
278
|
{siteConfig.tagline || siteConfig.title}
|
|
279
279
|
</h1>
|
|
@@ -302,6 +302,7 @@ export default function Layout(props) {
|
|
|
302
302
|
</svg>
|
|
303
303
|
</a>
|
|
304
304
|
</div>
|
|
305
|
+
<div className="govuk-grid-column-one-third-from-desktop" />
|
|
305
306
|
</div>
|
|
306
307
|
</div>
|
|
307
308
|
</div>
|
|
@@ -4,14 +4,13 @@ import { useLocation } from '@docusaurus/router';
|
|
|
4
4
|
/**
|
|
5
5
|
* Hash- and pathname-aware sidebar navigation.
|
|
6
6
|
*
|
|
7
|
-
* Desktop: section headings
|
|
8
|
-
*
|
|
7
|
+
* Desktop (≥770px): section headings are non-interactive spans; all groups
|
|
8
|
+
* are permanently expanded; active items get a left-border marker.
|
|
9
9
|
*
|
|
10
|
-
* Mobile: section headings become toggle buttons; groups collapse
|
|
11
|
-
* Active groups start expanded.
|
|
10
|
+
* Mobile (<770px): section headings become toggle buttons; groups collapse
|
|
11
|
+
* and expand. Active groups start expanded. Active marker is hidden.
|
|
12
12
|
*
|
|
13
|
-
* SSR / no-JS: renders in desktop mode (all groups expanded)
|
|
14
|
-
* accessible without JavaScript.
|
|
13
|
+
* SSR / no-JS: renders in desktop mode (all groups expanded).
|
|
15
14
|
*/
|
|
16
15
|
export default function SidebarNav({ items }) {
|
|
17
16
|
const [hash, setHash] = useState(null);
|
|
@@ -28,7 +27,7 @@ export default function SidebarNav({ items }) {
|
|
|
28
27
|
}, []);
|
|
29
28
|
|
|
30
29
|
useEffect(() => {
|
|
31
|
-
const mql = globalThis.matchMedia('(max-width:
|
|
30
|
+
const mql = globalThis.matchMedia('(max-width: 769px)');
|
|
32
31
|
const update = () => setIsMobile(mql.matches);
|
|
33
32
|
update();
|
|
34
33
|
mql.addEventListener('change', update);
|