|
989 | 989 | const overlay = d3.select("body") |
990 | 990 | .append("div") |
991 | 991 | .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}`); |
1020 | 1009 |
|
1021 | 1010 | header.append("button") |
1022 | 1011 | .attr("class", "medal-popup-close") |
1023 | 1012 | .text("Close") |
1024 | 1013 | .on("click", () => overlay.remove()); |
1025 | 1014 |
|
1026 | | - const chart = overlay.append("div") |
1027 | | - .style("width", "min(1200px, 96vw)"); |
| 1015 | + const chart = box.append("div") |
| 1016 | + .attr("class", "medal-detail-chart") |
1028 | 1017 |
|
1029 | 1018 | drawDetailSankey(chart, detail); |
1030 | 1019 |
|
|
1250 | 1239 | return text.length <= maxLength ? text : text.slice(0, maxLength - 1) + "…"; |
1251 | 1240 | } |
1252 | 1241 |
|
| 1242 | + //TODO: delete ? |
1253 | 1243 | function getTooltip() { |
1254 | 1244 | let tooltip = d3.select("body").select(".medal-tooltip"); |
1255 | 1245 |
|
|
0 commit comments