29 lines
700 B
React
29 lines
700 B
React
|
|
export function GateSelect({
|
||
|
|
roadmapItems = [],
|
||
|
|
name = 'roadmap_item_id',
|
||
|
|
defaultValue = '',
|
||
|
|
label = 'Zielzustand (Gate)',
|
||
|
|
allowEmpty = true,
|
||
|
|
}) {
|
||
|
|
if (roadmapItems.length === 0) return null
|
||
|
|
|
||
|
|
return (
|
||
|
|
<label>
|
||
|
|
{label}
|
||
|
|
<select name={name} defaultValue={defaultValue || ''}>
|
||
|
|
{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
|
||
|
|
}
|