|
4 | 4 | position: relative; |
5 | 5 | } |
6 | 6 |
|
7 | | -/* before the Vue component is mounted, show a loading indicator with dummy size */ |
8 | | -/* the ratio is guesswork, see https://github.com/razorness/vue3-calendar-heatmap/issues/26 */ |
9 | | -#user-heatmap.is-loading { |
10 | | - aspect-ratio: 5.415; /* the size is about 790 x 145 */ |
| 7 | +.activity-heatmap-container { |
| 8 | + container-type: inline-size; |
11 | 9 | } |
12 | | -.user.profile #user-heatmap.is-loading { |
13 | | - aspect-ratio: 5.645; /* the size is about 953 x 169 */ |
| 10 | + |
| 11 | +@container (width > 0) { |
| 12 | + #user-heatmap { |
| 13 | + /* Set element to fixed height so that it does not resize after load. The calculation is complex |
| 14 | + because the element does not scale with a fixed aspect ratio. */ |
| 15 | + height: calc((100cqw / 5) - (100cqw / 25) + 20px); |
| 16 | + } |
| 17 | +} |
| 18 | + |
| 19 | +/* Fallback height adjustment above for browsers that don't support container queries */ |
| 20 | +@supports not (container-type: inline-size) { |
| 21 | + /* Before the Vue component is mounted, show a loading indicator with dummy size */ |
| 22 | + /* The ratio is guesswork for legacy browsers, new browsers use the "@container" approach above */ |
| 23 | + #user-heatmap.is-loading { |
| 24 | + aspect-ratio: 5.4823972051; /* the size is about 816 x 148.84 */ |
| 25 | + } |
| 26 | + .user.profile #user-heatmap.is-loading { |
| 27 | + aspect-ratio: 5.6290608387; /* the size is about 953 x 169.3 */ |
| 28 | + } |
14 | 29 | } |
15 | 30 |
|
16 | 31 | #user-heatmap text { |
17 | 32 | fill: currentcolor !important; |
18 | 33 | } |
19 | 34 |
|
| 35 | +/* root legend */ |
| 36 | +#user-heatmap .vch__container > .vch__legend { |
| 37 | + display: flex; |
| 38 | + font-size: 11px; |
| 39 | + justify-content: space-between; |
| 40 | +} |
| 41 | + |
20 | 42 | /* for the "Less" and "More" legend */ |
21 | 43 | #user-heatmap .vch__legend .vch__legend { |
22 | 44 | display: flex; |
23 | | - font-size: 11px; |
24 | 45 | align-items: center; |
25 | 46 | justify-content: right; |
26 | 47 | } |
|
34 | 55 | #user-heatmap .vch__day__square:hover { |
35 | 56 | outline: 1.5px solid var(--color-text); |
36 | 57 | } |
37 | | - |
38 | | -/* move the "? contributions in the last ? months" text from top to bottom */ |
39 | | -#user-heatmap .total-contributions { |
40 | | - font-size: 11px; |
41 | | - position: absolute; |
42 | | - bottom: 0; |
43 | | - left: 25px; |
44 | | -} |
45 | | - |
46 | | -@media (max-width: 1200px) { |
47 | | - #user-heatmap .total-contributions { |
48 | | - left: 21px; |
49 | | - } |
50 | | -} |
51 | | - |
52 | | -@media (max-width: 1000px) { |
53 | | - #user-heatmap .total-contributions { |
54 | | - font-size: 10px; |
55 | | - left: 17px; |
56 | | - bottom: -4px; |
57 | | - } |
58 | | -} |
0 commit comments