1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-28 17:55:15 +02:00
unleash.unleash/frontend/src/component/common/TagSelect/TagSelect.tsx
olav 9bb0ce8cad refactor: improve GeneralSelect prop types (#883)
* refactor: improve GeneralSelect prop types

* refactor: Remove unused propTypes
2022-04-20 11:47:17 +02:00

38 lines
877 B
TypeScript

import React from 'react';
import GeneralSelect, {
IGeneralSelectProps,
} from '../GeneralSelect/GeneralSelect';
import useTagTypes from 'hooks/api/getters/useTagTypes/useTagTypes';
interface ITagSelect {
name: string;
value: string;
onChange: IGeneralSelectProps['onChange'];
autoFocus?: boolean;
}
const TagSelect = ({ value, onChange, ...rest }: ITagSelect) => {
const { tagTypes } = useTagTypes();
const options = tagTypes.map(tagType => ({
key: tagType.name,
label: tagType.name,
title: tagType.name,
}));
return (
<>
<GeneralSelect
label="Tag type"
id="tag-select"
options={options}
value={value}
onChange={onChange}
{...rest}
/>
</>
);
};
export default TagSelect;