diff --git a/src/heatmap/index.tsx b/src/heatmap/index.tsx index 4879eb5..62185f2 100644 --- a/src/heatmap/index.tsx +++ b/src/heatmap/index.tsx @@ -274,33 +274,6 @@ class CalendarHeatmap extends React.Component { ); } - renderAllWeeks() { - return getRange(this.getWeekCount()).map((weekIndex) => this.renderWeek(weekIndex)); - } - - renderMonthLabels() { - if (!this.props.showMonthLabels) { - return null; - } - - const adapter = (date) => { - const [x, y] = this.getMonthLabelCoordinates(dFns.differenceInWeeks(date, this.props.startDate)); - return { - x, - y - } - }; - - return <> - - {/*{...a}*/} - - } - renderWeekdayLabels() { if (!this.props.showWeekdayLabels) { return null; @@ -322,19 +295,36 @@ class CalendarHeatmap extends React.Component { render() { this.valueCache = this.getValueCache(this.props); + const monthPositionAdapter = (date) => { + const [x, y] = this.getMonthLabelCoordinates(dFns.differenceInWeeks(date, this.props.startDate)); + return { + x, + y + } + }; + + const weeks = dFns.eachWeekOfInterval({ + start: this.props.startDate, + end: this.props.endDate, + }); + return ( - {this.renderMonthLabels()} + {this.props.showMonthLabels && } - {this.renderAllWeeks()} + {weeks.map((_, index) => this.renderWeek(index))}