38 lines
826 B
JavaScript
38 lines
826 B
JavaScript
import { Form, Select as AntSelect } from 'antd';
|
|
import { Status } from 'core/types/statuses';
|
|
import React from 'react';
|
|
|
|
const Select = ({
|
|
value,
|
|
setCurrentValue,
|
|
status,
|
|
options,
|
|
filter,
|
|
...props
|
|
}) => {
|
|
return (
|
|
<Form.Item>
|
|
<AntSelect
|
|
{...props}
|
|
disabled={status === Status.Disabled}
|
|
optionFilterProp="children"
|
|
filterOption={filter}
|
|
value={value}
|
|
onChange={val => setCurrentValue(val)}
|
|
>
|
|
{(filter ? filter(options) : options).map((option, i) => {
|
|
if (option)
|
|
return (
|
|
<AntSelect.Option key={i} value={option.value}>
|
|
{option.name}
|
|
</AntSelect.Option>
|
|
);
|
|
return null;
|
|
})}
|
|
</AntSelect>
|
|
</Form.Item>
|
|
);
|
|
};
|
|
|
|
export default Select;
|