Skip to content

Commit b9972af

Browse files
Merge pull request #75 from communitiesuk/homepage-sections-layout
Homepage sections layout
2 parents 756366f + 3b93385 commit b9972af

File tree

13 files changed

+1728
-29
lines changed

13 files changed

+1728
-29
lines changed

src/routes/+layout.svelte

Lines changed: 144 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
3131
// --- Section-Level Derived State ---
3232
let activeSectionInfo = $derived.by(() => {
33+
if (currentPath.startsWith("/get-started")) {
34+
return { sectionName: "Get started", sectionHref: "/get-started" };
35+
}
3336
if (currentPath.startsWith("/components")) {
3437
return { sectionName: "Components", sectionHref: "/components" };
3538
}
@@ -61,21 +64,74 @@
6164
: [];
6265
6366
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[] = [
6477
{
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",
6683
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+
},
69119
],
70120
},
71121
];
72122
73-
const communityNavGroups: SideNavGroup[] = [
123+
const getStartedNavGroups: SideNavGroup[] = [
74124
{
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",
76133
items: [
77-
{ text: "Updates", href: "/community/updates" },
78-
{ text: "Contributing", href: "/community/contributing" },
134+
{ text: "Component statuses", href: "/get-started/component-statuses" },
79135
],
80136
},
81137
];
@@ -85,6 +141,8 @@
85141
const section = currentSection;
86142
87143
switch (section) {
144+
case "Get started":
145+
return getStartedNavGroups;
88146
case "Components":
89147
return componentNavGroups.map((group) => ({
90148
...group,
@@ -102,6 +160,15 @@
102160
}
103161
});
104162
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+
105172
// --- MobileNav Related Data Construction ---
106173
// Create structured component items for mobile navigation
107174
const structuredComponentItems =
@@ -110,10 +177,19 @@
110177
// Mobile navigation sections (MobileNav relies on activeSectionHref & activeDetailHref)
111178
const mobileNavSections = [
112179
{
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+
],
116187
},
188+
// {
189+
// title: "Home",
190+
// href: "/",
191+
// items: [{ text: "Overview", href: "/" }],
192+
// },
117193
{
118194
title: "Components",
119195
href: "/components",
@@ -123,21 +199,63 @@
123199
title: "Patterns",
124200
href: "/patterns",
125201
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+
// },
133209
],
134210
},
135211
{
136212
title: "Community",
137213
href: "/community",
138214
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+
},
141259
],
142260
},
143261
];
@@ -173,11 +291,11 @@
173291
/>
174292
<div
175293
class="app-pane__body"
176-
class:govuk-width-container={currentSection !== "Home"}
294+
class:govuk-width-container={currentPath !== "/"}
177295
>
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}
181299
<aside class="app-split-pane__nav">
182300
<SideNav
183301
title={getSectionTitle(currentSection)}
@@ -188,8 +306,9 @@
188306
{/if}
189307
<!-- Main content area -->
190308
<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 !== "/"}
193312
>
194313
{@render children()}
195314
</div>

0 commit comments

Comments
 (0)