11import styled from 'styled-components' ;
22import { HistoryType , RANK } from '@type/common' ;
33import { colors } from '@styles/theme' ;
4- import { MONTH_LABEL_MAPPING } from '@utils/constants' ;
5- import { getDate } from '@utils/utils' ;
4+ import { getDate , getMonthLabel } from '@utils/utils' ;
65
76const COMMIT_LEFT_BOUNDARY = 5 ;
87
@@ -31,6 +30,7 @@ function CommitHistory({ history, tier }: CommitHistoryProps) {
3130 { historyBlocks . map ( ( [ dateString , { level, count } ] , idx ) => {
3231 const weeks = ( idx + firstDay ) / 7 ;
3332 const { month, date, day } = getDate ( dateString ) ;
33+
3434 let isMonthLabelChange = false ;
3535 if ( prevMonth !== month && day === 0 ) {
3636 isMonthLabelChange = true ;
@@ -42,7 +42,7 @@ function CommitHistory({ history, tier }: CommitHistoryProps) {
4242 style = { { backgroundColor : level === 0 ? colors . commit0 : colors [ `${ tier } ${ level } ` ] } }
4343 >
4444 { date < 24 && day === 0 && isMonthLabelChange ? (
45- < MonthLabel > { MONTH_LABEL_MAPPING [ month ] } </ MonthLabel >
45+ < MonthLabel > { getMonthLabel ( new Date ( dateString ) ) } </ MonthLabel >
4646 ) : null }
4747 < ToolTip className = 'tooltip' weeks = { weeks } >
4848 < strong > { count || 'No' } </ strong > contribution on < strong > { dateString } </ strong >
@@ -164,7 +164,6 @@ const MonthLabel = styled.div`
164164
165165const DayLabel = styled . ul `
166166 position: absolute;
167- top: 0;
168167 left: -20px;
169168 font-size: 16px;
170169 height: 100%;
0 commit comments