import { useState } from '@wordpress/element';
export default function AnalysisPieDetail( props: AnalysisPieDetailProps ) {
const { label, subPoints, value, percentage } = props;
// console.log('subPoints', subPoints);
const [ isOpen, setIsOpen ] = useState( false );
const mainDetail = (
<>
{ label }
{ value }
{ percentage && (
{ percentage }
) }
>
);
return (
{ subPoints && subPoints.length > 0 ? (
<>
{ subPoints.map( ( point, index ) => (
<>
{ point.onClick ? (
) : (
{ point.label }
{ point.displayCount }
{ point.displayPercentage && (
{ point.displayPercentage }
) }
) }
>
) ) }
>
) : (
{ mainDetail }
) }
);
}