import * as React from 'react';
import * as PropTypes from 'prop-types';
import weui from '../../utils/weui';

import classNames from '../../utils/classnames';

export default function Picker(props) {
  const { title, children, className } = props;
  const click = function () {
    weui.picker(
      [
        {
          label: '飞机票',
          value: 0,
        },
        {
          label: '火车票',
          value: 1,
        },
        {
          label: '的士票',
          value: 2,
        },
        {
          label: '公交票 (disabled)',
          disabled: true,
          value: 3,
        },
        {
          label: '其他',
          value: 4,
        },
      ],
      {
        onChange() {
          // console.log(result);
        },
        onConfirm() {
          // console.log(result);
        },
        title,
      }
    );
  };
  const cls = classNames({
    'weda-ui': true,
    'weda-picker': true,
    [className]: className,
  });

  return (
    <div className={cls} onClick={click}>
      {children}
    </div>
  );
}
