summaryrefslogtreecommitdiff
path: root/ping/frontend/src/lib/components/NumberStatList.svelte
blob: b6444e83abdd535fcb91f832f4e1046bcae7739a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<script lang="ts">
	export interface INumberStatList {
		name: string;
		value: string;
		icon: string;
		color: string;
	}

	const { statsList = [] }: { statsList?: INumberStatList[] } = $props();
</script>

<section class="numberStatList">
	{#each statsList as stat}
		<div class="card">
			<img src={stat.icon} alt="" class="stat-icon" />
			<span class="stat-name">{stat.name}</span>
			<span class="stat-value" style:color={stat.color}>{stat.value}</span>
		</div>
	{/each}
</section>

<style>
	.numberStatList {
		color: white;
		display: flex;
		width: 100%;
		align-items: stretch;
		justify-content: stretch;
	}

	.numberStatList :global(.card) {
		flex: 1;
		display: grid;
		grid-template-areas: 'icon name' 'icon amount';
		align-items: center;
		justify-content: space-around;
	}

	.stat-icon {
		width: 24px;
		height: 24px;
		grid-area: icon;
	}

	.stat-name {
		grid-area: name;
		font-weight: bold;
	}

	.stat-value {
		grid-area: amount;
		font-size: 1.2em;
		font-weight: bold;
	}
</style>