@@ -12,18 +12,27 @@ interface ContributionHeatmapProps {
1212 endDate : string
1313 title ?: string
1414 unit ?: string
15+ stats ?: {
16+ commits ?: number
17+ pullRequests ?: number
18+ issues ?: number
19+ total ?: number
20+ }
21+ variant ?: 'default' | 'compact'
1522}
1623
1724const ContributionHeatmap : React . FC < ContributionHeatmapProps > = ( {
1825 contributionData,
1926 startDate,
2027 endDate,
21- title,
2228 unit = 'contribution' ,
29+ variant = 'default' ,
2330} ) => {
2431 const { theme } = useTheme ( )
2532 const isDarkMode = theme === 'dark'
2633
34+ const isCompact = variant === 'compact'
35+
2736 const { heatmapSeries } = useMemo ( ( ) => {
2837 const start = new Date ( startDate )
2938 const end = new Date ( endDate )
@@ -239,13 +248,8 @@ const ContributionHeatmap: React.FC<ContributionHeatmapProps> = ({
239248 }
240249
241250 return (
242- < div >
243- { title && (
244- < h4 className = "mb-1 text-sm text-gray-700 dark:text-gray-300" >
245- < span className = "font-semibold" > { title } </ span >
246- </ h4 >
247- ) }
248- < div className = "w-full" >
251+ < div className = "" >
252+ < div className = "max-w-5xl" >
249253 < style >
250254 { `
251255 .apexcharts-tooltip {
@@ -256,34 +260,29 @@ const ContributionHeatmap: React.FC<ContributionHeatmapProps> = ({
256260 .apexcharts-tooltip * {
257261 border: none !important;
258262 }
259- .heatmap-container {
260- aspect-ratio: 4 / 1;
261- min-height: 132px;
262- max-width: 100%;
263- width: min(100%, 800px);
263+ .heatmap-container-${ isCompact ? 'compact' : 'default' } {
264+ width: 100%;
265+ ${ isCompact ? 'min-width: 380px;' : 'max-width: 100%; overflow: visible;' }
264266 }
265- @media (max-width: 768px) {
266- .heatmap-container {
267- width: min(100%, 600px);
268- }
267+ .heatmap-container-${ isCompact ? 'compact' : 'default' } .apexcharts-heatmap-rect {
268+ rx: 2;
269+ ry: 2;
269270 }
270- @media (max-width: 480px) {
271- .heatmap-container {
272- width: min(100%, 400px);
271+ ${ ! isCompact ? '.heatmap-container-default .apexcharts-canvas { transform: scale(0.85); transform-origin: left top; }' : '' }
272+ @media (max-width: 768px) {
273+ .heatmap-container-${ isCompact ? 'compact' : 'default' } {
274+ ${ isCompact ? 'min-width: 320px;' : 'transform: scale(0.7); transform-origin: left top;' }
273275 }
274276 }
275- .heatmap-container .apexcharts-canvas {
276- height: 100% !important;
277- }
278277 ` }
279278 </ style >
280- < div className = " heatmap-container" >
279+ < div className = { ` heatmap-container- ${ isCompact ? 'compact' : 'default' } ` } >
281280 < Chart
282281 options = { options }
283282 series = { heatmapSeries }
284283 type = "heatmap"
285- height = " 100%"
286- width = " 100%"
284+ height = { isCompact ? ' 100%' : 200 }
285+ width = { isCompact ? ' 100%' : '1200px' }
287286 />
288287 </ div >
289288 </ div >
0 commit comments