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