|
30 | 30 |
|
31 | 31 | // --- Section-Level Derived State ---
|
32 | 32 | let activeSectionInfo = $derived.by(() => {
|
| 33 | + if (currentPath.startsWith("/get-started")) { |
| 34 | + return { sectionName: "Get started", sectionHref: "/get-started" }; |
| 35 | + } |
33 | 36 | if (currentPath.startsWith("/components")) {
|
34 | 37 | return { sectionName: "Components", sectionHref: "/components" };
|
35 | 38 | }
|
|
61 | 64 | : [];
|
62 | 65 |
|
63 | 66 | const patternNavGroups: SideNavGroup[] = [
|
| 67 | + // { |
| 68 | + // title: "Common patterns", |
| 69 | + // items: [ |
| 70 | + // { text: "Forms", href: "/patterns/forms" }, |
| 71 | + // { text: "Tables", href: "/patterns/tables" }, |
| 72 | + // ], |
| 73 | + // }, |
| 74 | + ]; |
| 75 | +
|
| 76 | + const communityNavGroups: SideNavGroup[] = [ |
64 | 77 | {
|
65 |
| - title: "Common patterns", |
| 78 | + title: "What we're working on", |
| 79 | + items: [{ text: "Roadmap", href: "/community/roadmap" }], |
| 80 | + }, |
| 81 | + { |
| 82 | + title: "Ways to get involved", |
66 | 83 | items: [
|
67 |
| - { text: "Forms", href: "/patterns/forms" }, |
68 |
| - { text: "Tables", href: "/patterns/tables" }, |
| 84 | + { |
| 85 | + text: "Share findings about your users", |
| 86 | + href: "/community/share-findings", |
| 87 | + }, |
| 88 | + { |
| 89 | + text: "Propose a component or pattern", |
| 90 | + href: "/community/propose-component", |
| 91 | + }, |
| 92 | + { |
| 93 | + text: "Develop a component or pattern", |
| 94 | + href: "/community/develop-component", |
| 95 | + }, |
| 96 | + { |
| 97 | + text: "Propose a content change using GitHub", |
| 98 | + href: "/community/propose-content-change", |
| 99 | + }, |
| 100 | + ], |
| 101 | + }, |
| 102 | + { |
| 103 | + title: "How we work", |
| 104 | + items: [ |
| 105 | + { |
| 106 | + text: "Our team and delivery approach", |
| 107 | + href: "/community/team-approach", |
| 108 | + }, |
| 109 | + { text: "Projects", href: "/community/projects" }, |
| 110 | + { text: "Community principles", href: "/community/principles" }, |
| 111 | + { |
| 112 | + text: "Contribution approach", |
| 113 | + href: "/community/contribution-approach", |
| 114 | + }, |
| 115 | + { |
| 116 | + text: "Blog posts, videos and podcasts", |
| 117 | + href: "/community/blog-posts", |
| 118 | + }, |
69 | 119 | ],
|
70 | 120 | },
|
71 | 121 | ];
|
72 | 122 |
|
73 |
| - const communityNavGroups: SideNavGroup[] = [ |
| 123 | + const getStartedNavGroups: SideNavGroup[] = [ |
74 | 124 | {
|
75 |
| - title: "Community", |
| 125 | + title: "Setup guides", |
| 126 | + items: [ |
| 127 | + { text: "About & Benefits", href: "/get-started/about-benefits" }, |
| 128 | + { text: "Installation and usage", href: "/get-started" }, |
| 129 | + ], |
| 130 | + }, |
| 131 | + { |
| 132 | + title: "Component library usage guides", |
76 | 133 | items: [
|
77 |
| - { text: "Updates", href: "/community/updates" }, |
78 |
| - { text: "Contributing", href: "/community/contributing" }, |
| 134 | + { text: "Component statuses", href: "/get-started/component-statuses" }, |
79 | 135 | ],
|
80 | 136 | },
|
81 | 137 | ];
|
|
85 | 141 | const section = currentSection;
|
86 | 142 |
|
87 | 143 | switch (section) {
|
| 144 | + case "Get started": |
| 145 | + return getStartedNavGroups; |
88 | 146 | case "Components":
|
89 | 147 | return componentNavGroups.map((group) => ({
|
90 | 148 | ...group,
|
|
102 | 160 | }
|
103 | 161 | });
|
104 | 162 |
|
| 163 | + // Check if there are any navigation items to show |
| 164 | + const hasNavigationItems = $derived.by(() => { |
| 165 | + const groups = navGroupsForCurrentSection; |
| 166 | + if (!groups || groups.length === 0) return false; |
| 167 | +
|
| 168 | + // Check if any group has items |
| 169 | + return groups.some((group) => group.items && group.items.length > 0); |
| 170 | + }); |
| 171 | +
|
105 | 172 | // --- MobileNav Related Data Construction ---
|
106 | 173 | // Create structured component items for mobile navigation
|
107 | 174 | const structuredComponentItems =
|
|
110 | 177 | // Mobile navigation sections (MobileNav relies on activeSectionHref & activeDetailHref)
|
111 | 178 | const mobileNavSections = [
|
112 | 179 | {
|
113 |
| - title: "Home", |
114 |
| - href: "/", |
115 |
| - items: [{ text: "Overview", href: "/" }], |
| 180 | + title: "Get started", |
| 181 | + href: "/get-started", |
| 182 | + items: [ |
| 183 | + { text: "Installation and usage", href: "/get-started" }, |
| 184 | + { text: "About & Benefits", href: "/get-started/about-benefits" }, |
| 185 | + { text: "Component statuses", href: "/get-started/component-statuses" }, |
| 186 | + ], |
116 | 187 | },
|
| 188 | + // { |
| 189 | + // title: "Home", |
| 190 | + // href: "/", |
| 191 | + // items: [{ text: "Overview", href: "/" }], |
| 192 | + // }, |
117 | 193 | {
|
118 | 194 | title: "Components",
|
119 | 195 | href: "/components",
|
|
123 | 199 | title: "Patterns",
|
124 | 200 | href: "/patterns",
|
125 | 201 | items: [
|
126 |
| - { |
127 |
| - title: "Common patterns", |
128 |
| - items: [ |
129 |
| - { text: "Forms", href: "/patterns/forms" }, |
130 |
| - { text: "Tables", href: "/patterns/tables" }, |
131 |
| - ], |
132 |
| - }, |
| 202 | + // { |
| 203 | + // title: "Common patterns", |
| 204 | + // items: [ |
| 205 | + // { text: "Forms", href: "/patterns/forms" }, |
| 206 | + // { text: "Tables", href: "/patterns/tables" }, |
| 207 | + // ], |
| 208 | + // }, |
133 | 209 | ],
|
134 | 210 | },
|
135 | 211 | {
|
136 | 212 | title: "Community",
|
137 | 213 | href: "/community",
|
138 | 214 | items: [
|
139 |
| - { text: "Updates", href: "/community/updates" }, |
140 |
| - { text: "Contributing", href: "/community/contributing" }, |
| 215 | + { |
| 216 | + title: "What we're working on", |
| 217 | + items: [{ text: "Roadmap", href: "/community/roadmap" }], |
| 218 | + }, |
| 219 | + { |
| 220 | + title: "Ways to get involved", |
| 221 | + items: [ |
| 222 | + { |
| 223 | + text: "Share findings about your users", |
| 224 | + href: "/community/share-findings", |
| 225 | + }, |
| 226 | + { |
| 227 | + text: "Propose a component or pattern", |
| 228 | + href: "/community/propose-component", |
| 229 | + }, |
| 230 | + { |
| 231 | + text: "Develop a component or pattern", |
| 232 | + href: "/community/develop-component", |
| 233 | + }, |
| 234 | + { |
| 235 | + text: "Propose a content change using GitHub", |
| 236 | + href: "/community/propose-content-change", |
| 237 | + }, |
| 238 | + ], |
| 239 | + }, |
| 240 | + { |
| 241 | + title: "How we work", |
| 242 | + items: [ |
| 243 | + { |
| 244 | + text: "Our team and delivery approach", |
| 245 | + href: "/community/team-approach", |
| 246 | + }, |
| 247 | + { text: "Projects", href: "/community/projects" }, |
| 248 | + { text: "Community principles", href: "/community/principles" }, |
| 249 | + { |
| 250 | + text: "Contribution approach", |
| 251 | + href: "/community/contribution-approach", |
| 252 | + }, |
| 253 | + { |
| 254 | + text: "Blog posts, videos and podcasts", |
| 255 | + href: "/community/blog-posts", |
| 256 | + }, |
| 257 | + ], |
| 258 | + }, |
141 | 259 | ],
|
142 | 260 | },
|
143 | 261 | ];
|
|
173 | 291 | />
|
174 | 292 | <div
|
175 | 293 | class="app-pane__body"
|
176 |
| - class:govuk-width-container={currentSection !== "Home"} |
| 294 | + class:govuk-width-container={currentPath !== "/"} |
177 | 295 | >
|
178 |
| - <div class={currentSection !== "Home" ? "app-split-pane" : ""}> |
179 |
| - <!-- Side navigation - only shown if not Home --> |
180 |
| - {#if currentSection !== "Home"} |
| 296 | + <div class={currentPath !== "/" ? "app-split-pane" : ""}> |
| 297 | + <!-- Side navigation - only shown if not Home and has navigation items --> |
| 298 | + {#if currentPath !== "/" && hasNavigationItems} |
181 | 299 | <aside class="app-split-pane__nav">
|
182 | 300 | <SideNav
|
183 | 301 | title={getSectionTitle(currentSection)}
|
|
188 | 306 | {/if}
|
189 | 307 | <!-- Main content area -->
|
190 | 308 | <div
|
191 |
| - class:app-split-pane__content={currentSection !== "Home"} |
192 |
| - class:app-content={currentSection !== "Home"} |
| 309 | + class:app-split-pane__content={currentPath !== "/" && |
| 310 | + hasNavigationItems} |
| 311 | + class:app-content={currentPath !== "/"} |
193 | 312 | >
|
194 | 313 | {@render children()}
|
195 | 314 | </div>
|
|
0 commit comments