Skip to content

Commit 3854886

Browse files
committed
Adjust spacing and icons
1 parent 1a2fcca commit 3854886

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/cards/stats-card.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ const createTextNode = ({
2424
const labelOffset = showIcons ? `x="25"` : "";
2525
const iconSvg = showIcons
2626
? `
27-
<svg data-testid="icon" class="icon" viewBox="0 0 16 16" version="1.1" width="16" height="16">
27+
<svg data-testid="icon" class="icon" y="2" viewBox="0 0 16 16" version="1.1" width="16" height="16">
2828
${icon}
2929
</svg>
3030
`
3131
: "";
3232
return `
3333
<g class="stagger" style="animation-delay: ${staggerDelay}ms" transform="translate(25, 0)">
3434
${iconSvg}
35-
<text class="stat bold" ${labelOffset} y="12.5">${label}:</text>
35+
<text class="stat bold" ${labelOffset} y="15">${label}:</text>
3636
<text
3737
class="stat"
38-
x="${(showIcons ? 140 : 120) + 85}"
39-
y="12.5"
38+
x="${(showIcons ? 140 : 120) + 70}"
39+
y="15"
4040
data-testid="${id}"
4141
>${kValue}</text>
4242
</g>
@@ -64,7 +64,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
6464
hide_title = false,
6565
hide_border = false,
6666
hide_rank = false,
67-
line_height = 25,
67+
line_height = 30,
6868
title_color,
6969
icon_color,
7070
text_color,
@@ -92,37 +92,37 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
9292
// Meta data for creating text nodes with createTextNode function
9393
const STATS = {
9494
cg: {
95-
icon: icons.star,
95+
icon: icons.book,
9696
label: "Total Games Played",
9797
value: cg,
9898
id: "cg",
9999
},
100100
gamesWon: {
101-
icon: icons.commits,
101+
icon: icons.book,
102102
label: "Total Games Won",
103103
value: gamesWon,
104104
id: "gamesWon",
105105
},
106106
bestGameWpm: {
107-
icon: icons.prs,
107+
icon: icons.star,
108108
label: "High score",
109109
value: `${bestGameWpm} WPM`,
110110
id: "bestGameWpm",
111111
},
112-
WPM: {
113-
icon: icons.issues,
112+
wpm: {
113+
icon: icons.star,
114114
label: "Avg speed (all time)",
115115
value: `${wpm} WPM`,
116116
id: "wpm",
117117
},
118118
recentAvgWpm: {
119-
icon: icons.contribs,
119+
icon: icons.star,
120120
label: "Avg speed (last 10 races)",
121121
value: `${recentAvgWpm} WPM`,
122122
id: "recentAvgWpm",
123123
},
124124
recentScores: {
125-
icon: icons.contribs,
125+
icon: icons.book,
126126
label: "Last 10 races",
127127
value: `[${recentScores.toString()}]`,
128128
id: "recentScores",
@@ -145,7 +145,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
145145
// but if rank circle is visible clamp the minimum height to `150`
146146
let height = Math.max(
147147
45 + (statItems.length + 1) * lheight,
148-
hide_rank ? 0 : 150,
148+
hide_rank ? 0 : 170,
149149
);
150150

151151
// Conditionally rendered elements

src/common/icons.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/card.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe("Card", () => {
5757
});
5858

5959
it("title should have prefix icon", () => {
60-
const card = new Card({ title: "ok", titlePrefixIcon: icons.contribs });
60+
const card = new Card({ title: "ok", titlePrefixIcon: icons.book });
6161

6262
document.body.innerHTML = card.render(``);
6363
expect(document.getElementsByClassName("icon")[0]).toBeInTheDocument();

tests/renderStatsCard.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe("Test renderStatsCard", () => {
2929

3030
expect(
3131
document.body.getElementsByTagName("svg")[0].getAttribute("height"),
32-
).toBe("220");
32+
).toBe("255");
3333
expect(getByTestId(document.body, "cg").textContent).toBe("9.1k");
3434
expect(getByTestId(document.body, "gamesWon").textContent).toBe("1.9k");
3535
expect(getByTestId(document.body, "bestGameWpm").textContent).toBe("110 WPM");
@@ -47,7 +47,7 @@ describe("Test renderStatsCard", () => {
4747

4848
expect(
4949
document.body.getElementsByTagName("svg")[0].getAttribute("height"),
50-
).toBe("150"); // height should be 150 because we clamped it.
50+
).toBe("170"); // height should be 150 because we clamped it.
5151

5252
expect(queryByTestId(document.body, "wpm")).toBeDefined();
5353
expect(queryByTestId(document.body, "bestGameWpm")).toBeDefined();

0 commit comments

Comments
 (0)