import React from 'react';
import { Select } from 'antd';
import { observer } from 'mobx-react';
import { HotelStars as options } from '../../libs/ht';

const HotelStars = (props) => {
  const { mode, value, onChange, show_all, ...extProps } = props;
  const _show_all = ['tags', 'multiple'].includes(mode) ? false : show_all;
  return (
    <div>
      <Select
        mode={mode || null}
        allowClear
        style={{ width: '100%' }}
        placeholder="星级"
        value={value || undefined}
        onChange={(value) => {
          if (typeof onChange === 'function') {
            onChange(value);
          }
        }}
        labelInValue={false}
        {...extProps}
        options={options}
      >
        {_show_all ? (
          <Select.Option key="-1" value="ALL">
            ALL
          </Select.Option>
        ) : (
          ''
        )}
      </Select>
    </div>
  );
};
/**
 * 酒店星级
 */
export default observer(HotelStars);
