Skip to content

Commit

Permalink
fix(curriculum): highlight "Getting started" in module overview (#11051)
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner authored May 3, 2024
1 parent 4d215d3 commit a3dd9b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/src/curriculum/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "./about.scss";

export function CurriculumAbout(props: HydrationData<any, CurriculumDoc>) {
const doc = useCurriculumDoc(props);
// [["About"], ["the", "MDN", "Curriculum"]]
const [coloredTitle, ...restTitle] = doc?.title?.split(" ") || [];
return (
<CurriculumLayout
Expand Down
9 changes: 7 additions & 2 deletions client/src/curriculum/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ export function CurriculumModuleOverview(
props: HydrationData<any, CurriculumDoc>
) {
const doc = useCurriculumDoc(props as CurriculumData);
const [coloredTitle, ...restTitle] = doc?.title?.split(" ") || [];
// ["Getting", "started", "modules"]
const titleParts = doc?.title?.split(" ") || [];
// "Getting started"
const coloredTitle = titleParts.slice(0, -1).join(" ");
// "modules"
const restTitle = titleParts.at(-1);
return (
<CurriculumLayout
doc={doc}
extraClasses={["curriculum-overview", `topic-${topic2css(doc?.topic)}`]}
>
<header>
<h1>
<span>{coloredTitle}</span> {restTitle.join(" ")}
<span>{coloredTitle}</span> {restTitle}
</h1>
</header>
<RenderCurriculumBody doc={doc} />
Expand Down

0 comments on commit a3dd9b4

Please sign in to comment.