import React, { useEffect, useRef, useState } from 'react'; import { Card } from './ui/card'; import { Button } from './ui/button'; interface RecipeInfoModalProps { infoLabel?: string; originalValue?: string; isOpen: boolean; onClose: () => void; onSaveValue?: (val: string) => void; } export default function RecipeInfoModal({ infoLabel = '', isOpen, onClose, originalValue = '', onSaveValue = () => {}, }: RecipeInfoModalProps) { const [value, setValue] = useState(originalValue); const textareaRef = useRef(null); useEffect(() => { if (isOpen) { setValue(originalValue); textareaRef.current?.focus(); } }, [isOpen, originalValue]); const onSave = (event: React.FormEvent) => { onSaveValue(value); event.preventDefault(); onClose(); }; if (!isOpen) return null; return (

Edit {infoLabel}