add servings information to recipe

This commit is contained in:
Anika Raemer 2025-09-07 15:32:43 +02:00
parent 5c8ddf96f2
commit fee47da55d
7 changed files with 71 additions and 8 deletions

View file

@ -34,7 +34,32 @@ export default function RecipeEditor({ recipe, onSave, onCancel }: RecipeEditorP
value={draft.title}
onChange={e => setDraft({ ...draft, title: e.target.value })}
/>
{/* Servings */}
<h3 className="subsection-heading">Servings</h3>
<div className="columns-3 gap-2 flex items-center">
<label>For</label>
<input
type="number"
className="input-field w-20"
placeholder="1"
value={draft.servings.amount}
onChange={e => {
let tempServings = draft.servings
tempServings.amount = Number(e.target.value)
setDraft({...draft, servings: tempServings})
}}
/>
<input
className="input-field"
placeholder="Persons"
value={draft.servings.unit}
onChange={e => {
let tempServings = draft.servings
tempServings.unit = e.target.value
setDraft({...draft, servings: tempServings})
}}
/>
</div>
{/* Ingredient List */}
<IngredientListEditor
ingredients={draft.ingredients}