import { type ChangeEvent } from "react"; import type { RecipeInstruction } from "../../types/recipe"; import { Reorder, useDragControls } from "motion/react"; import DragIconSmall from "../icons/DragIconSmall"; import DeleteIconSmall from "../icons/DeleteIconSmall"; interface InstructionElementProps { instruction: RecipeInstruction; index: number; allowDelete: boolean; onChange: (id: string, value: string) => void; onDelete: (id: string) => void; valid: boolean; dirty: boolean; markDirty: (id: string) => void; } export default function InstructionElement({ instruction, index, allowDelete, onChange, onDelete, valid, dirty, markDirty }: InstructionElementProps) { const controls = useDragControls(); const changeHandler = (e: ChangeEvent) => { if (!dirty) markDirty(instruction.Id) onChange(instruction.Id, e.target.value); } return (

{index + 1}.