import { Select } from '@easyv/antd';
import React from 'react';
import styles from './SortOption.less';

const { Option } = Select;

type sortType = 'byCreatedAt' | 'byUpdatedAt';
interface Props {
  onChange: (v: sortType) => void;
}

const SortOption = (props: Props) => {
  return (
    <div className={styles.sort_wrapper}>
      <Select
        dropdownClassName={styles.dropClass}
        className={styles.option}
        onChange={(e: sortType) => props.onChange(e)}
        defaultValue="byUpdatedAt"
        style={{ display: 'inline-block' }}
        bordered={false}>
        <Option value="byUpdatedAt">按修改时间排序</Option>
        <Option value="byCreatedAt">按新建时间排序</Option>
      </Select>
    </div>
  );
};

export default SortOption;
