diff --git a/app/src/frontend/building/data-components/select-data-entry.tsx b/app/src/frontend/building/data-components/select-data-entry.tsx index 73723d90..b8b52873 100644 --- a/app/src/frontend/building/data-components/select-data-entry.tsx +++ b/app/src/frontend/building/data-components/select-data-entry.tsx @@ -3,16 +3,31 @@ import React, { Fragment } from 'react'; import { BaseDataEntryProps } from './data-entry'; import { DataTitleCopyable } from './data-title'; +interface SelectOption { + value: string; + label: string; +} + interface SelectDataEntryProps extends BaseDataEntryProps { value: string; placeholder?: string; - options: string[]; + options: (string | SelectOption)[]; } +function makeOption(option: string | SelectOption): SelectOption { + if(typeof option !== 'string' && 'value' in option && 'label' in option) { + return option; + } else return { + value: option, + label: option + } +} const SelectDataEntry: React.FunctionComponent = (props) => { const slugWithModifier = props.slug + (props.slugModifier ?? ''); + const options = props.options.map(makeOption); + return ( = (props) = > { - props.options.map(option => ( - + options.map(option => ( + )) }