import React from 'react'; import { Rectangle } from 'recharts'; import theme from '../theme'; export default class Job extends React.PureComponent { render() { const { x, y, payload: { name, formerStartTime, formerEndTime, startTime, endTime }, xAxis: { niceTicks, width: axisWidth } } = this.props; if (!endTime) return null; const duration = Math.abs(endTime - startTime); if (!duration) return null; const formerDuration = Math.abs( (typeof formerEndTime === 'undefined' ? endTime : formerEndTime) - (typeof formerStartTime === 'undefined' ? startTime : formerStartTime) ); const width = (axisWidth / (niceTicks.length - 1)) * duration; const height = theme.gantt.job.height; return ( ); } } class JobBox extends React.PureComponent { render() { const { x, y, width, height } = this.props; let { duration, name } = this.props; const { fill, stroke, textColor } = theme.gantt.job; return ( {duration} {name} ); } }