Skip to content

Commit af03d5e

Browse files
committed
Adds calls to the copy code to clipboard functionality.
1 parent 76ead2b commit af03d5e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pages/lessons/[section]/[slug].js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,23 @@ import { getLesson, getLessons } from "../../../data/lesson";
44
import getCourseConfig from "../../../data/course";
55
import Corner from "../../../components/corner";
66
import { Context } from "../../../context/headerContext";
7+
import createCopyCodeFunctionality from "../../../data/copyCode";
78

89
export default function LessonSlug({ post }) {
910
const courseInfo = getCourseConfig();
1011
const [_, setHeader] = useContext(Context);
12+
1113
useEffect(() => {
1214
setHeader({
1315
section: post.section,
1416
title: post.title,
1517
icon: post.icon,
1618
});
17-
return () => setHeader({});
19+
let elementsToClean = createCopyCodeFunctionality();
20+
return () => {
21+
setHeader({});
22+
elementsToClean = [];
23+
}
1824
}, []);
1925

2026
const title = post.title

0 commit comments

Comments
 (0)