This commit is contained in:
ditiqi 2025-02-06 19:23:45 +08:00
parent 9e7d722248
commit f363117c1d
1 changed files with 8 additions and 2 deletions

View File

@ -1,12 +1,16 @@
import { motion } from "framer-motion";
import { NavItem } from "@nice/client";
import { useCourseEditor } from "../context/CourseEditorContext";
interface CourseSidebarProps {
id?: string | undefined;
isHovered: boolean;
setIsHovered: (value: boolean) => void;
navItems: NavItem[];
navItems: (NavItem & { isInitialized?: boolean; isCompleted?: boolean })[];
selectedSection: number;
onNavigate: (item: NavItem, index: number) => void;
onNavigate: (
item: NavItem & { isInitialized?: boolean; isCompleted?: boolean },
index: number
) => void;
}
export default function CourseEditorSidebar({
@ -16,6 +20,7 @@ export default function CourseEditorSidebar({
selectedSection,
onNavigate,
}: CourseSidebarProps) {
const { editId } = useCourseEditor();
return (
<motion.nav
initial={{ width: "5rem" }}
@ -29,6 +34,7 @@ export default function CourseEditorSidebar({
<button
key={index}
type="button"
disabled={!editId && !item.isInitialized}
onClick={(e) => {
e.preventDefault();
onNavigate(item, index);