import clsx from "clsx" import React from "react" import LearningPathIcon from "./Icon" import { getLearningPath } from "../../utils/learning-paths" import { useLearningPath } from "../../providers/LearningPath" import { Button, useNotifications } from "docs-ui" import { CircleMiniSolid } from "@medusajs/icons" 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 ${pathName} 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