import React from 'react';
import { Icon, Rate } from 'antd';
import { RateProps } from '../detailInterface';

export default function Detail(props: RateProps) {
    const { value, formatter } = props;
    let formatValue = formatter ? formatter(value) : value;
    if (!formatValue) return null;

    formatValue = parseInt(formatValue || 0);
    if (isNaN(formatValue)) {
        return null;
    } else {
        return <Rate disabled value={formatValue} character={<Icon type="like" theme="filled" />} />;
    }
}
