blob: ffa976b2c43d5f59396d8e4115c1ea3a827fc56d (
plain) (
blame)
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
56
57
58
59
60
61
62
63
64
65
|
<script lang="ts">
import {
STATUS_LABELS,
type RoutineStatus,
} from '$lib/shared/routine-metrics';
let {
status,
overdueDays = 0,
}: { status: RoutineStatus; overdueDays?: number } = $props();
const icon = $derived(
status === 'ok'
? '✓'
: status === 'due'
? '◷'
: status === 'late'
? '!'
: '‼',
);
const label = $derived(
overdueDays > 0
? `${STATUS_LABELS[status]} (${overdueDays} j)`
: STATUS_LABELS[status],
);
</script>
<span class="status {status}" role="img" aria-label={label} title={label}
>{icon}</span
>
<style>
.status {
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.5rem;
height: 1.5rem;
font-size: 0.875rem;
font-weight: 700;
line-height: 1;
}
.ok {
background: var(--success);
color: var(--white);
}
.due {
background: var(--warn-bg);
color: var(--warn);
}
.late {
background: var(--warn);
color: var(--white);
}
.veryLate {
background: var(--danger);
color: var(--white);
}
</style>
|