import { Reorder } from "motion/react"; import InstructionElement from "./InstructionElement"; import type { Dispatch, SetStateAction } from "react"; import type { RecipeInstruction } from "../../types/recipe"; interface InstructionListProps { instructions: RecipeInstruction[]; setInstructions: Dispatch>; } export default function InstructionList({ instructions, setInstructions }: InstructionListProps) { const handleChange = (id: string, value: string) => { setInstructions(prev => prev.map(instr => instr.Id === id ? { ...instr, Content: value } : instr ) ); }; const handleDelete = (id: string) => { setInstructions(prev => prev.filter(instr => instr.Id !== id) ); } return ( {instructions.map((instruction, i) => ( 1} onChange={handleChange} onDelete={handleDelete} /> ))} ); }