Kairo-Jinkendo/frontend/src/components/GateSelect.jsx

30 lines
740 B
React
Raw Normal View History

export function GateSelect({
roadmapItems = [],
name = 'roadmap_item_id',
defaultValue = '',
label = 'Zielzustand (Gate)',
allowEmpty = true,
disabled = false,
}) {
if (roadmapItems.length === 0) return null
return (
<label>
{label}
<select name={name} defaultValue={defaultValue || ''} disabled={disabled}>
{allowEmpty && <option value="">— keins —</option>}
{roadmapItems.map((item) => (
<option key={item.id} value={item.id}>
{item.title}
</option>
))}
</select>
</label>
)
}
export function gateTitleById(roadmapItems, gateId) {
if (!gateId) return null
return roadmapItems.find((item) => item.id === gateId)?.title || null
}