import { Task } from "@/components/interfaces"; import GanttElasticContext from "@/GanttElasticContext"; import React, { useContext, useMemo } from "react"; export interface ProgressBarProps { task: Task; clipPath: string; } const ProgressBar: React.FC = ({ task, ...props }) => { const { style, options } = useContext(GanttElasticContext); return useMemo(() => { // Get progress width const progressWidth = task.progress + "%"; // Get line points const start = (task.width / 100) * task.progress; const linePoints = `M ${start} 0 L ${start} ${task.height}`; return ( {options.chart.progress.bar && ( )} {options.chart.progress.pattern && ( )} ); }, [ options.chart.progress.bar, options.chart.progress.pattern, options.chart.progress.width, style, task.height, task.progress, task.style, task.width ]); }; export default ProgressBar;