import { useLearningPath } from "@site/src/providers/LearningPath" import { useNotifications } from "@site/src/providers/NotificationProvider" import { getLearningPath } from "@site/src/utils/learning-paths" import clsx from "clsx" import React from "react" import useBaseUrl from "@docusaurus/useBaseUrl" import Button from "../Button" import IconCircleMiniSolid from "@site/src/theme/Icon/CircleMiniSolid" import LearningPathIcon from "./Icon" type LearningPathProps = { pathName: string className?: string } & React.AllHTMLAttributes const LearningPath: React.FC = ({ pathName, className = "", }) => { const path = getLearningPath(pathName) if (!path) { throw new Error("Learning path does not exist.") } const { startPath, path: currentPath } = useLearningPath() const notificationContext = useNotifications() const handleClick = () => { if (notificationContext && currentPath?.notificationId) { notificationContext.removeNotification(currentPath.notificationId) } startPath(path) } return (
{path.label} {path.description && ( {path.description} )}
{path.steps.map((step, index) => (
{step.title}
))}
) } export default LearningPath