|
1
|
import React, { useMemo } from "react" |
|
2
|
import { getLearningPaths } from "../../../utils/learning-paths" |
|
3
|
import { LearningPath } from ".." |
|
4
|
|
|
5
|
type LearningPathListProps = { |
|
6
|
ignore?: string[] |
|
7
|
} & React.AllHTMLAttributes<HTMLDivElement> |
|
8
|
|
|
9
|
export const LearningPathList = ({ ignore = [] }: LearningPathListProps) => { |
|
10
|
const paths = useMemo(() => { |
|
11
|
const paths = getLearningPaths() |
|
12
|
ignore.forEach((pathName) => { |
|
13
|
const pathIndex = paths.findIndex((path) => path.name === pathName) |
|
14
|
if (pathIndex !== -1) { |
|
15
|
paths.splice(pathIndex, 1) |
|
16
|
} |
|
17
|
}) |
|
18
|
|
|
19
|
return paths |
|
20
|
}, [ignore]) |
|
21
|
|
|
22
|
return ( |
|
23
|
<div className="flex flex-col flex-wrap gap-docs_2 mt-docs_1.5"> |
|
24
|
{paths.map((path, index) => ( |
|
25
|
<LearningPath |
|
26
|
pathName={path.name} |
|
27
|
key={index} |
|
28
|
className="!mt-0 !mb-0" |
|
29
|
/> |
|
30
|
))} |
|
31
|
</div> |
|
32
|
) |
|
33
|
} |