@defra/docusaurus-theme-govuk 0.0.14-alpha → 0.0.15-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.14-alpha",
3
+ "version": "0.0.15-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",
@@ -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: 40.0625em) {
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: 4px solid #1d70b8;
110
- padding-left: 11px;
111
- font-weight: bold;
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-width: 4px;
130
- padding-left: 11px;
131
- font-weight: bold;
144
+ border-left: none;
132
145
 
133
- .not-govuk-navigation-menu__list__link {
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 left
172
- &::before {
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-top: 4px solid transparent;
178
- border-bottom: 4px solid transparent;
179
- border-left: 5px solid currentColor;
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-right: 8px;
182
- transition: transform 0.2s ease;
199
+ margin-left: 8px;
183
200
  }
184
201
 
185
- &[aria-expanded="true"]::before {
186
- transform: rotate(90deg);
202
+ &[aria-expanded="true"]::after {
203
+ transform: rotate(180deg);
187
204
  }
188
205
 
189
206
  &:focus {
190
- outline: 3px solid #fd0;
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: 767px) {
437
+ @media (max-width: 769px) {
422
438
  .govuk-header__container {
423
439
  flex-direction: column;
424
440
  align-items: flex-start;
@@ -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 (items with children) are rendered as plain text,
8
- * all groups are permanently expanded, only sub-items are links.
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 and expand.
11
- * Active groups start expanded. Items without children are always links.
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) so content is
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: 767px)');
30
+ const mql = globalThis.matchMedia('(max-width: 769px)');
32
31
  const update = () => setIsMobile(mql.matches);
33
32
  update();
34
33
  mql.addEventListener('change', update);