Skip to content

Commit 654c2e2

Browse files
committed
style: sync pop ups
1 parent 8a6b67e commit 654c2e2

3 files changed

Lines changed: 35 additions & 52 deletions

File tree

website/js/delegations.js

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -989,42 +989,31 @@
989989
const overlay = d3.select("body")
990990
.append("div")
991991
.attr("class", "medal-detail-overlay")
992-
.style("position", "fixed")
993-
.style("inset", "0")
994-
.style("z-index", "99999")
995-
.style("background", "rgba(0, 0, 0, 0.96)")
996-
.style("color", "white")
997-
.style("display", "flex")
998-
.style("flex-direction", "column")
999-
.style("align-items", "center")
1000-
.style("justify-content", "center")
1001-
.style("padding", "34px")
1002-
.style("box-sizing", "border-box");
1003-
1004-
const header = overlay.append("div")
1005-
.style("width", "min(1200px, 96vw)")
1006-
.style("display", "flex")
1007-
.style("align-items", "center")
1008-
.style("justify-content", "space-between")
1009-
.style("margin-bottom", "18px");
1010-
1011-
header.append("div")
1012-
.html(`
1013-
<div style="font-family:'Elms Sans', sans-serif; font-size:28px; font-weight:800;">
1014-
${detail.medal} medals in ${detail.sport}
1015-
</div>
1016-
<div style="font-family:'Elms Sans', sans-serif; font-size:15px; color:rgba(255,255,255,0.72); margin-top:4px;">
1017-
${detail.season} Olympics, ${detail.year} · grouped by ${detail.mode}
1018-
</div>
1019-
`);
992+
993+
const box = overlay.append("div")
994+
.attr("class", "medal-detail-box")
995+
996+
const header = box.append("div")
997+
.attr("class", "medal-detail-header");
998+
999+
const titleBlock = header.append("div")
1000+
.attr("class", "medal-detail-title-block");
1001+
1002+
titleBlock.append("div")
1003+
.attr("class", "medal-detail-title")
1004+
.text(`${detail.medal} medals in ${detail.sport}`)
1005+
1006+
titleBlock.append("div")
1007+
.attr("class", "medal-detail-note")
1008+
.text(`${detail.season} Olympics, ${detail.year} · grouped by ${detail.mode}`);
10201009

10211010
header.append("button")
10221011
.attr("class", "medal-popup-close")
10231012
.text("Close")
10241013
.on("click", () => overlay.remove());
10251014

1026-
const chart = overlay.append("div")
1027-
.style("width", "min(1200px, 96vw)");
1015+
const chart = box.append("div")
1016+
.attr("class", "medal-detail-chart")
10281017

10291018
drawDetailSankey(chart, detail);
10301019

@@ -1250,6 +1239,7 @@
12501239
return text.length <= maxLength ? text : text.slice(0, maxLength - 1) + "…";
12511240
}
12521241

1242+
//TODO: delete ?
12531243
function getTooltip() {
12541244
let tooltip = d3.select("body").select(".medal-tooltip");
12551245

website/js/geopolitics-conflicts.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@
382382
data: participationData,
383383
xKey: "year",
384384
yKey: "value",
385-
title: `Participation around ${selected.year}`,
386385
yLabel: "Participating countries",
387386
highlightValue: selected.year,
388387
tooltipFormatter: d => formatNeighborTooltip(d, "Participating countries")
@@ -741,7 +740,7 @@
741740
svg.append("text")
742741
.attr("x", margin.left)
743742
.attr("y", 24)
744-
.attr("font-family", "Arial, sans-serif")
743+
.attr("font-family", "Elms Sans, sans-serif")
745744
.attr("font-size", 18)
746745
.attr("font-weight", 700)
747746
.attr("fill", "white")
@@ -752,7 +751,7 @@
752751
.attr("x", width / 2)
753752
.attr("y", height / 2)
754753
.attr("text-anchor", "middle")
755-
.attr("font-family", "Arial, sans-serif")
754+
.attr("font-family", "Elms Sans, sans-serif")
756755
.attr("font-size", 22)
757756
.attr("fill", "white")
758757
.text("No data available");
@@ -818,7 +817,7 @@
818817
.call(d3.axisBottom(x).tickSizeOuter(0))
819818
.call(g => g.selectAll("text")
820819
.attr("fill", "white")
821-
.attr("font-family", "Arial, sans-serif")
820+
.attr("font-family", "Elms Sans, sans-serif")
822821
.attr("font-size", 12)
823822
.attr("transform", "rotate(-28)")
824823
.attr("text-anchor", "end"))
@@ -829,15 +828,15 @@
829828
.call(d3.axisLeft(y).ticks(5))
830829
.call(g => g.selectAll("text")
831830
.attr("fill", "white")
832-
.attr("font-family", "Arial, sans-serif")
831+
.attr("font-family", "Elms Sans, sans-serif")
833832
.attr("font-size", 12))
834833
.call(g => g.selectAll("path,line").attr("stroke", "white"));
835834

836835
svg.append("text")
837836
.attr("x", margin.left)
838837
.attr("y", 42)
839838
.attr("fill", "rgba(255,255,255,0.72)")
840-
.attr("font-family", "Arial, sans-serif")
839+
.attr("font-family", "Elms Sans, sans-serif")
841840
.attr("font-size", 12)
842841
.text(yLabel);
843842
}

website/styles.css

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ h4 {
674674
color: #f4b400;
675675
}
676676

677+
/* TODO: delete ? */
677678
.geo-tooltip {
678679
position: fixed;
679680
pointer-events: none;
@@ -690,6 +691,7 @@ h4 {
690691
transition: opacity 0.12s ease;
691692
}
692693

694+
.medal-detail-overlay,
693695
.geo-popup-overlay {
694696
position: fixed;
695697
inset: 0;
@@ -702,6 +704,7 @@ h4 {
702704
box-sizing: border-box;
703705
}
704706

707+
.medal-detail-box,
705708
.geo-popup-box {
706709
width: min(980px, 94vw);
707710
max-height: 88vh;
@@ -713,6 +716,7 @@ h4 {
713716
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
714717
}
715718

719+
.medal-detail-header,
716720
.geo-popup-header {
717721
display: flex;
718722
justify-content: space-between;
@@ -721,10 +725,12 @@ h4 {
721725
margin-bottom: 12px;
722726
}
723727

728+
.medal-detail-title-block,
724729
.geo-popup-title-block {
725730
text-align: left;
726731
}
727732

733+
.medal-detail-title,
728734
.geo-popup-title {
729735
color: white;
730736
font-family: "Elms Sans", sans-serif;
@@ -733,15 +739,17 @@ h4 {
733739
text-align: left;
734740
}
735741

742+
.medal-detail-note,
736743
.geo-popup-note {
737744
margin-top: 6px;
738745
color: #ffd166;
739746
font-family: "Elms Sans", sans-serif;
740-
font-size: 14px;
747+
font-size: 16px;
741748
line-height: 1.35;
742749
text-align: left;
743750
}
744751

752+
.medal-popup-close,
745753
.geo-popup-close {
746754
background: #ffd166;
747755
color: #111;
@@ -753,6 +761,7 @@ h4 {
753761
cursor: pointer;
754762
}
755763

764+
.medal-popup-close:hover,
756765
.geo-popup-close:hover {
757766
filter: brightness(1.06);
758767
}
@@ -914,21 +923,6 @@ h4 {
914923
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
915924
}
916925

917-
.medal-popup-close {
918-
background: #ffd166;
919-
color: #111;
920-
border: 2px solid white;
921-
border-radius: 10px;
922-
padding: 8px 14px;
923-
font-size: 15px;
924-
font-weight: 800;
925-
cursor: pointer;
926-
}
927-
928-
.medal-popup-close:hover {
929-
filter: brightness(1.06);
930-
}
931-
932926
/* =============================================
933927
Body types section
934928
=========================================== */

0 commit comments

Comments
 (0)