Skip to content

Commit ae41698

Browse files
authored
feat: add clickable link to Gauge & add link to licenses (#274)
1 parent 2d7c3f1 commit ae41698

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

public/css/components/gauge.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
.gauge {
22
display: flex;
33
flex-direction: column;
4-
padding: 0 10px;
54
}
65

76
.gauge>.line {
87
display: flex;
98
flex-direction: column;
109
color: #546884;
10+
padding: 0 10px;
11+
border-radius: 4px;
12+
}
13+
14+
.gauge>.line.clickable:hover {
15+
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%);
16+
cursor: pointer;
1117
}
1218

1319
.gauge>.line.hidden {
@@ -26,7 +32,8 @@
2632
}
2733

2834
.gauge>.line>.line--column span {
29-
width: 20px;
35+
width: 30px;
36+
flex-shrink: 0;
3037
text-align: right;
3138
font-family: "mononoki";
3239
color: var(--secondary-darker);

public/js/components/gauge.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class Gauge {
8181
const hideItems = this.data.length > this.maxLength;
8282

8383
for (let id = 0; id < this.data.length; id++) {
84-
const { name, value, chips = null } = this.data[id];
84+
const { name, value, link = null, chips = null } = this.data[id];
8585
if (value === 0) {
8686
continue;
8787
}
@@ -90,6 +90,11 @@ export class Gauge {
9090
if (hideItems && id >= this.maxLength) {
9191
line.classList.add("hidden");
9292
}
93+
if (link !== null) {
94+
line.classList.add("clickable");
95+
line.addEventListener("click", () => window.open(link, "_blank"));
96+
}
97+
9398
childs.push(line);
9499
}
95100

public/js/components/home.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export class HomeView {
177177
{
178178
name,
179179
value,
180+
link: result.value.spdxLicenseLinks?.[0] ?? null,
180181
chips: Object.entries(result.value.spdx)
181182
.filter(([key]) => key !== "includesDeprecated")
182183
.map(([key, value]) => `${value ? "✔️" : "❌"} ${key}`)

0 commit comments

Comments
 (0)