import React from 'react'; import {IVocabularyItem} from 'superdesk-api'; import {getVocabularyItemNameTranslated} from 'core/utils'; interface IProps { selectedItemLabel: string; options: Array; onChange(item: IVocabularyItem): void; tabIndex: number; disabled: boolean; language: string; } export class MetaDataDropdownSingleSelectReact extends React.PureComponent { render() { const {selectedItemLabel, options, language, tabIndex, disabled} = this.props; const optionsWithTranslations = options.map((option) => ({label: getVocabularyItemNameTranslated(option, language), value: option.qcode, option})); const selectedValue = optionsWithTranslations.find( (option) => option.label === selectedItemLabel, )?.option.qcode ?? ''; return (
); } }