Skip to content

Commit 27a4525

Browse files
committed
Extact section ids
1 parent 24a4756 commit 27a4525

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/app/(main)/resources/[category]/blog-posts-section.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import { Button } from "@/app/conf/_design-system/button"
44
import { Eyebrow } from "@/_design-system/eyebrow"
55
import { BlogCard } from "@/components/blog-page/blog-card"
6-
7-
import { sectionId } from "./texts"
6+
import { sectionIds } from "./texts"
87

98
export interface BlogPost {
109
href: string
@@ -31,7 +30,7 @@ export function BlogPostsSection({
3130
}: BlogPostsSectionProps) {
3231
return (
3332
<section
34-
id={sectionId("Blog posts")}
33+
id={sectionIds["blog-or-newsletter"]}
3534
className="gql-container gql-section flex flex-col gap-10 lg:gap-16"
3635
>
3736
<header className="flex flex-col gap-6 lg:flex-row lg:items-end lg:justify-between">

src/app/(main)/resources/[category]/cards-section.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Button } from "@/app/conf/_design-system/button"
44

55
import { ResourceHubCard } from "../resource-hub-card"
66

7-
import { texts, sectionKindNames, sectionId } from "./texts"
7+
import { texts, sectionKindNames, sectionIds } from "./texts"
88

99
function sectionLabel(kind: Kind) {
1010
return sectionKindNames[kind] ?? `${kind[0].toUpperCase()}${kind.slice(1)}`
@@ -20,11 +20,10 @@ export function CardsSection({
2020
const sectionData = texts[category].sections[section.kind]
2121
const heading = sectionData?.heading ?? sectionLabel(section.kind)
2222
const text = sectionData?.text
23-
const label = sectionLabel(section.kind)
2423

2524
return (
2625
<section
27-
id={sectionId(label)}
26+
id={sectionIds[section.kind]}
2827
className="gql-container gql-section flex flex-col gap-6"
2928
>
3029
<header className="flex items-center justify-between gap-4">

src/components/toc-hero/toc-hero-contents.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { clsx } from "clsx"
22

33
import { ChevronRight } from "@/app/conf/_design-system/pixelarticons/chevron-right"
4+
import { slugify } from "@/app/(main)/resources/[category]/texts"
45

56
export interface TocHeroContentsProps
67
extends React.HTMLAttributes<HTMLDivElement> {
@@ -34,7 +35,7 @@ export function TocHeroContents({
3435
typeof section === "string"
3536
? {
3637
name: section,
37-
href: `#${section.toLowerCase().replace(/ /g, "-")}`,
38+
href: `#${slugify(section)}`,
3839
}
3940
: section
4041

0 commit comments

Comments
 (0)