Skip to content

Commit 4764b3f

Browse files
committed
Revert to old footer links, simplify the code
1 parent 309a4f4 commit 4764b3f

File tree

2 files changed

+80
-68
lines changed

2 files changed

+80
-68
lines changed

src/components/footer/index.tsx

Lines changed: 78 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,84 @@ interface FooterSection {
2222
links: FooterLink[]
2323
}
2424

25-
const FOOTER_SECTIONS_COUNT = 4
26-
const MAX_LINKS_PER_SECTION = 5
25+
const FOOTER_SECTIONS: FooterSection[] = [
26+
{
27+
title: "Learn",
28+
route: "/learn",
29+
links: [
30+
{ title: "Introduction to GraphQL", route: "/learn" },
31+
{
32+
title: "Frequently Asked Questions",
33+
route: "/faq",
34+
},
35+
{
36+
title: "Training Courses",
37+
route: "/community/resources/training-courses",
38+
},
39+
],
40+
},
41+
{
42+
title: "Code",
43+
links: [
44+
{ title: "GitHub", route: "https://github.com/graphql" },
45+
{
46+
title: "GraphQL Specification",
47+
route: "/spec",
48+
},
49+
{ title: "Libraries & Tools", route: "/code" },
50+
{
51+
title: "Services & Vendors",
52+
route: "/code/?tags=services",
53+
},
54+
],
55+
},
56+
{
57+
title: "Community",
58+
links: [
59+
{
60+
title: "Resources",
61+
route: "/community/resources/official-channels",
62+
},
63+
{
64+
title: "Events & Meetups",
65+
route: "/community/events",
66+
},
67+
{
68+
title: "Contribute to GraphQL",
69+
route: "/community/contribute/essential-links",
70+
},
71+
{ title: "Landscape", route: "/landscape" },
72+
{ title: "Shop", route: "/shop" },
73+
],
74+
},
75+
{
76+
title: "& More",
77+
links: [
78+
{ title: "Blog", route: "/blog" },
79+
{
80+
title: "GraphQL Foundation",
81+
route: "/foundation",
82+
},
83+
{
84+
title: "GraphQL Community Grant",
85+
route: "/foundation/community-grant",
86+
},
87+
{
88+
title: "Logo and Brand Guidelines",
89+
route: "/brand",
90+
},
91+
{
92+
title: "Code of Conduct",
93+
route: "/codeofconduct",
94+
},
95+
],
96+
},
97+
]
98+
2799
const CONFERENCE_YEAR = 2025
100+
const HAS_CONFERENCE_BOX = true
28101

29-
export function Footer({ extraLinks }: { extraLinks: FooterLink[] }) {
30-
const { sections, hasConferenceBox } = useFooterSections(extraLinks)
102+
export function Footer() {
31103
const themeConfig = useThemeConfig()
32104

33105
return (
@@ -42,7 +114,7 @@ export function Footer({ extraLinks }: { extraLinks: FooterLink[] }) {
42114
</div>
43115

44116
<div className="grid grid-cols-2 gap-px bg-neu-400 py-px dark:bg-neu-100 lg:grid-cols-5">
45-
{sections.map((section, i) => (
117+
{FOOTER_SECTIONS.map((section, i) => (
46118
<div
47119
className="typography-menu relative bg-neu-100 py-4 dark:bg-neu-0 lg:py-6 3xl:py-10"
48120
key={i}
@@ -73,7 +145,7 @@ export function Footer({ extraLinks }: { extraLinks: FooterLink[] }) {
73145
</div>
74146
))}
75147
<div className="flex flex-col max-lg:contents">
76-
{hasConferenceBox && (
148+
{HAS_CONFERENCE_BOX && (
77149
<ConferenceFooterBox
78150
href={`/conf/${CONFERENCE_YEAR}`}
79151
className="z-[2] col-span-full flex-1 max-lg:row-start-1"
@@ -151,42 +223,3 @@ function Stripes() {
151223
</div>
152224
)
153225
}
154-
155-
function useFooterSections(extraLinks: FooterLink[]): {
156-
sections: FooterSection[]
157-
hasConferenceBox: boolean
158-
} {
159-
const { normalizePagesResult } = useConfig()
160-
161-
const sections: FooterSection[] = []
162-
const singleLinks: FooterLink[] = []
163-
let hasConferenceBox = false
164-
165-
for (const item of normalizePagesResult.topLevelNavbarItems) {
166-
if (
167-
(item.type === "page" || item.type === "menu") &&
168-
item.children?.length &&
169-
sections.length < FOOTER_SECTIONS_COUNT - 1
170-
) {
171-
sections.push({
172-
title: item.title,
173-
route: item.route,
174-
links: (item.children || [])
175-
.filter(child => child.route)
176-
.slice(0, MAX_LINKS_PER_SECTION)
177-
.map(child => ({ title: child.title, route: child.route })),
178-
})
179-
} else if (singleLinks.length < MAX_LINKS_PER_SECTION) {
180-
if (item.route && item.route.startsWith("/conf/")) {
181-
hasConferenceBox = true
182-
} else {
183-
singleLinks.push({ title: item.title, route: item.route })
184-
}
185-
}
186-
}
187-
188-
singleLinks.push(...extraLinks)
189-
sections.push({ links: singleLinks })
190-
191-
return { sections, hasConferenceBox }
192-
}

theme.config.tsx

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default {
4545
</>
4646
)
4747
},
48-
// Hidden for now, Design is discussing it.
48+
// Hidden for now, new design is done, but not implemented yet.
4949
// banner: {
5050
// content: (
5151
// <>
@@ -75,28 +75,7 @@ export default {
7575
defaultMenuCollapseLevel: 1,
7676
},
7777
footer: {
78-
component: () => (
79-
<Footer
80-
extraLinks={[
81-
{
82-
title: "Community Grant",
83-
route: "https://graphql.org/foundation/community-grant/",
84-
},
85-
{
86-
title: "Code of Conduct",
87-
route: "https://graphql.org/codeofconduct/",
88-
},
89-
{
90-
title: "Brand",
91-
route: "https://graphql.org/brand/",
92-
},
93-
// {
94-
// title: "Swag Shop",
95-
// route: "https://store.graphql.org/",
96-
// },
97-
]}
98-
/>
99-
),
78+
component: () => <Footer />,
10079
content: "Copyright © 2025 The GraphQL Foundation. All rights reserved.",
10180
},
10281
navbar: {

0 commit comments

Comments
 (0)