Skip to content

Commit

Permalink
feat: Add week day info into each graph element when hidden week days
Browse files Browse the repository at this point in the history
  • Loading branch information
firejune committed Nov 7, 2023
1 parent f6a5046 commit c462cd1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/app/[username]/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export type Contrib = {
}

type ChartProps = {
data: Contrib[][]
username: string
count?: string
username?: string
data?: Contrib[][]
options?: {
options: {
boxMargin?: number
borderRadius?: number
showWeekDays?: boolean
Expand Down Expand Up @@ -70,7 +70,9 @@ const Chart = ({
fill={`var(--color-calendar-graph-day-${day.count ? `L${day.intensity}-` : ''}bg)`}
stroke={`var(--color-calendar-graph-day-${day.count ? `L${day.intensity}-` : ''}border)`}
>
<title>{`${day.date || ''} / ${day.count || '0'}`}</title>
<title>
{`${day.date}${showWeekDays ? '' : `(${format(parseISO(day.date), 'EEE')})`} / ${day.count || '0'}`}
</title>
</rect>
))}
</g>
Expand Down Expand Up @@ -116,7 +118,7 @@ const Chart = ({
</g>
)}

{showFooter && username && count && (
{showFooter && count && (
<g transform={`translate(${textWidth}, ${chartHeight - textHeight})`}>
<text dy={textHeight} style={{ fontSize }} fill="var(--color-text-default)">
{`${count} contribution${count === '1' ? '' : 's'} in the last year by @${username} on GitHub`}
Expand Down

0 comments on commit c462cd1

Please sign in to comment.