Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 1394e9f

Browse files
authored
feat(Learn): mark learn section title as read (#3098)
* Feat: mark section title as read * Chore: update snapshot
1 parent 98621dc commit 1394e9f

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

src/navigations/learn.module.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717
height: 14px;
1818
padding: 0 var(--space-24) 0 0;
1919
}
20+
21+
&--done::before {
22+
content: $checkSvg;
23+
}
24+
25+
&--done::before,
26+
&--done:hover::before {
27+
box-shadow: inset 0 0 0 2.4rem var(--color-border-accent);
28+
}
2029
}
2130

2231
.item {

src/navigations/learn.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ const LearnNavigationSection = ({
1414
section,
1515
children,
1616
currentSlug,
17+
isAllRead,
1718
}: React.PropsWithChildren<NavigationSectionData>) => {
1819
const { isSectionOpen, toggleSection } = useNavigationSection({
1920
section,
2021
currentSlug,
2122
});
2223

23-
const titleClassNames = classnames('t-body2', styles.title);
24+
const titleClassNames = classnames('t-body2', styles.title, {
25+
[styles.titleDone]: isAllRead,
26+
});
2427

2528
const sectionTitle = (
2629
<button
@@ -67,6 +70,7 @@ const LearnNavigation = ({ sections, currentSlug }: Props) => {
6770
title={key}
6871
section={data}
6972
currentSlug={currentSlug}
73+
isAllRead={data.every(({ slug }) => isRead(slug))}
7074
>
7175
{data.map(item => (
7276
<NavigationComponents.NavigationItem

src/templates/__tests__/__snapshots__/learn.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ exports[`Learn Template renders correctly 1`] = `
263263
>
264264
<button
265265
aria-expanded="false"
266-
class="t-body2 title"
266+
class="t-body2 title titleDone"
267267
type="button"
268268
>
269269
<span>
@@ -311,7 +311,7 @@ exports[`Learn Template renders correctly 1`] = `
311311
>
312312
<button
313313
aria-expanded="false"
314-
class="t-body2 title"
314+
class="t-body2 title titleDone"
315315
type="button"
316316
>
317317
<span>

src/types/navigation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export interface NavigationSectionData {
22
title: string;
33
section: NavigationItemData[];
44
currentSlug: string;
5+
isAllRead?: boolean;
56
}
67

78
export interface NavigationItemData {

0 commit comments

Comments
 (0)