Skip to content

Commit 2a6c638

Browse files
committed
feat: Modified styles
1 parent a17b059 commit 2a6c638

2 files changed

Lines changed: 85 additions & 85 deletions

File tree

components/GitHeatMap.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// GitHeatMap.tsx
21
import { useEffect, useState } from 'react';
32
import Day from './Day';
43
import style from '../styles/git.module.scss';
@@ -85,18 +84,21 @@ const GitHeatMap = () => {
8584
))}
8685
</div>
8786
<div className={style.clBox}>
88-
<div className={style.chartWrapper}>
89-
<div className={style.chart}>
90-
{days.map((day) => (
91-
<Day
92-
key={day.date}
93-
date={day.date}
94-
count={day.count}
95-
sources={day.sources}
96-
/>
97-
))}
87+
<div className={style.chartOuter}>
88+
<div className={style.chartScroll}>
89+
<div className={style.chart}>
90+
{days.map((day) => (
91+
<Day
92+
key={day.date}
93+
date={day.date}
94+
count={day.count}
95+
sources={day.sources}
96+
/>
97+
))}
98+
</div>
9899
</div>
99100
</div>
101+
100102
<div className={style.legend}>
101103
{colors.map((color, idx) => (
102104
<div key={idx} className={style.legendItem}>

styles/git.module.scss

Lines changed: 72 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,43 @@
22
display: flex;
33
flex-direction: column;
44
align-items: center;
5-
width: fit-content;
65
width: 90%;
76
overflow: visible;
87
}
98

10-
.chartWrapper {
11-
overflow-x: visible;
12-
overflow-y: visible;
9+
.chartOuter {
10+
overflow: visible; /* popovers must escape here */
1311
width: 100%;
12+
position: relative;
1413
}
1514

16-
@media only screen and (max-width: 1180px) {
17-
.clBox {
18-
width: 95vw !important;
19-
}
15+
.chartScroll {
16+
overflow: visible; /* default for desktop */
17+
width: 100%;
2018
}
2119

2220
@media only screen and (max-width: 768px) {
23-
.chart {
24-
grid-template-columns: repeat(53, 20px) !important; /* 53 weeks */
21+
.chartScroll {
22+
overflow-x: scroll; /* horizontal scroll only */
23+
overflow-y: visible; /* critical: popovers can go UP */
2524
}
26-
.chart::-webkit-scrollbar-track {
27-
background-color: #0f1019; /* track background */
25+
26+
.chartScroll::-webkit-scrollbar-track {
27+
background-color: #0f1019;
2828
border-radius: 6px;
2929
}
30-
.chartWrapper {
31-
overflow-x: scroll;
30+
}
31+
32+
@media only screen and (max-width: 1180px) {
33+
.clBox {
34+
width: 95vw !important;
3235
}
3336
}
3437

3538
.clBox {
3639
display: flex;
3740
flex-direction: column;
3841
align-items: center;
39-
width: fit-content;
4042
width: 80%;
4143
overflow: visible;
4244
}
@@ -45,70 +47,77 @@
4547
display: grid;
4648
justify-content: center;
4749
align-items: center;
48-
grid-template-columns: repeat(53, 1fr); /* 53 weeks */
50+
grid-template-columns: repeat(53, 1fr);
4951
gap: 2px;
5052
width: 100%;
5153
overflow: visible;
5254
}
55+
56+
@media only screen and (max-width: 768px) {
57+
.chart {
58+
grid-template-columns: repeat(53, 20px) !important;
59+
}
60+
}
61+
5362
.dayWrapper {
5463
position: relative;
64+
overflow: visible !important; /* safety */
65+
}
5566

56-
.day {
57-
border-radius: 2px;
58-
transition: background-color 0.2s;
59-
cursor: pointer;
60-
width: inherit;
61-
height: auto;
62-
aspect-ratio: 1/1;
63-
}
67+
.dayWrapper .day {
68+
border-radius: 2px;
69+
transition: background-color 0.2s;
70+
cursor: pointer;
71+
width: inherit;
72+
height: auto;
73+
aspect-ratio: 1/1;
74+
}
6475

65-
.day:hover {
66-
outline: 1px solid #333;
67-
}
76+
.dayWrapper .day:hover {
77+
outline: 1px solid #333;
78+
}
6879

69-
.day:hover::after {
70-
content: attr(title);
71-
position: absolute;
72-
left: 50%;
73-
bottom: 100%;
74-
transform: translateX(-50%);
75-
white-space: pre; // preserves line breaks
76-
background: #1a1a2e;
77-
color: #fff;
78-
padding: 4px 8px;
79-
border-radius: 4px;
80-
font-size: 12px;
81-
pointer-events: none;
82-
z-index: 10;
83-
text-transform: capitalize;
84-
overflow: visible !important;
85-
}
80+
.dayWrapper .day:hover::after {
81+
content: attr(title);
82+
position: absolute;
83+
left: 50%;
84+
bottom: 100%;
85+
transform: translateX(-50%);
86+
white-space: pre;
87+
background: #1a1a2e;
88+
color: #fff;
89+
padding: 4px 8px;
90+
border-radius: 4px;
91+
font-size: 12px;
92+
pointer-events: none;
93+
z-index: 9999;
94+
overflow: visible !important;
8695
}
8796

8897
.legend {
8998
display: flex;
90-
justify-content: center; // center the legend
99+
justify-content: center;
91100
align-items: center;
92101
align-self: flex-start;
93102
margin-top: 16px;
103+
}
94104

95-
.legendItem {
96-
display: flex;
97-
flex-direction: column;
98-
align-items: center;
99-
margin: 0 4px;
100-
101-
.legendColor {
102-
width: 14px;
103-
height: 14px;
104-
border-radius: 2px;
105-
margin-bottom: 2px;
106-
}
107-
108-
span {
109-
font-size: 12px;
110-
}
111-
}
105+
.legend .legendItem {
106+
display: flex;
107+
flex-direction: column;
108+
align-items: center;
109+
margin: 0 4px;
110+
}
111+
112+
.legend .legendColor {
113+
width: 14px;
114+
height: 14px;
115+
border-radius: 2px;
116+
margin-bottom: 2px;
117+
}
118+
119+
.legend span {
120+
font-size: 12px;
112121
}
113122

114123
.box {
@@ -131,14 +140,13 @@
131140
display: grid;
132141
place-items: center;
133142
transition: 0.3s;
134-
background-color: #1a1b2b; // subtle background for better contrast
143+
background-color: #1a1b2b;
135144
}
136145

137146
.elementBox p {
138147
font-size: 1.2em;
139148
text-align: center !important;
140149
text-transform: capitalize;
141-
padding: 0;
142150
margin-top: 2px;
143151
}
144152

@@ -155,17 +163,7 @@
155163
text-transform: capitalize;
156164
}
157165

158-
.elementBox ul li {
159-
text-transform: capitalize;
160-
}
161-
162166
.elementBox:hover {
163167
box-shadow: 16px 16px 16px rgba(0, 0, 0, 0.6);
164168
transform: scale(1.02);
165169
}
166-
167-
.elementBox ul {
168-
margin-top: 0.5em;
169-
padding-left: 0;
170-
list-style: none;
171-
}

0 commit comments

Comments
 (0)