import React, { useMemo } from 'react';
import { Select } from 'antd';

const { Option } = Select;


const qrcodeType = props => {
    //   const [data, setData] = useState([])
    //   useEffect(() => {

    //   }, [props.value])
    // const visible2 = props.visible || true
    const all = props.all || false

    const visible = useMemo(() => (props.visible), [props.visible]);
    
    const data = [
        {
            name: '项目',
            value: 'building',
            visible,
        },
        {
            name: '报名活动',
            value: 'activity',
            visible,
        },
        {
            name: '助力活动',
            value: 'help',
            visible,
        },
        {
            name: '拼团活动',
            value: 'group',
            visible,
        },
        {
            name: 'H5活动',
            value: 'h5',
            visible: true,
        },
        {
            name: '直播活动',
            value: 'live',
            visible: true,
        },
        {
            name: '资讯',
            value: 'news',
            visible,
        },
        {
            name: '在线选房',
            value: 'house',
            visible,
        },
    ]


    return (
        // <>234</>
        <Select
            showSearch
            value={props.value}
            style={{ width: '250px' }}
            placeholder="请选择二维码内容类型"
            onChange={props.onChange}
            // filterOption={(input, option) =>
            //     // eslint-disable-next-line max-len
            //     option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
            // }
        >
            {all && <Option key="" value="">全部类型</Option>}
            {data.map(Item => (

                Item.visible ? <Option key={Item.vlaue} value={Item.value}> {Item.name} </Option> : ''
            ))}
        </Select>
    )
}
export default qrcodeType
