import React from 'react';
import Tag from '../tag';
import { SelectProps } from '../detailInterface';

export default function Detail(props: SelectProps) {
    const { value, componentAttr } = props;
    if (!value) return null;

    const { isMultiple, options } = componentAttr || {};
    const selfAttr: any = isMultiple ? { maxTagCount: 2 } : { maxTagCount: 1 };
    if (Array.isArray(options)) {
        selfAttr.options = options;
    }

    if (typeof value === 'object') {
        return <Tag value={value} {...selfAttr} />;
    }
}
