-
Notifications
You must be signed in to change notification settings - Fork 334
Expand file tree
/
Copy pathStatusRow.vue
More file actions
79 lines (71 loc) · 1.49 KB
/
StatusRow.vue
File metadata and controls
79 lines (71 loc) · 1.49 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<script setup lang="ts">
import { RcCounterBadge } from '@components/Pill';
import SubtleLink from '@shell/components/SubtleLink.vue';
import { StateColor, stateColorCssVar } from '@shell/utils/style';
import type { RouteLocationRaw } from 'vue-router';
export interface Props {
color: StateColor;
label: string;
count: number;
percent: number;
showPercent?: boolean;
to?: RouteLocationRaw;
}
const {
color, label, count, percent, showPercent = true, to
} = defineProps<Props>();
</script>
<template>
<div class="status-row">
<div
class="indicator"
:style="{backgroundColor: stateColorCssVar(color)}"
/>
<div class="label">
<SubtleLink
v-if="to"
:to="to"
>
{{ label }}
</SubtleLink>
<template v-else>
{{ label }}
</template>
</div>
<div class="count">
<RcCounterBadge
:count="count"
type="inactive"
/>
</div>
<div
v-if="showPercent"
class="percent text-muted"
>
{{ percent.toFixed(1) }}%
</div>
</div>
</template>
<style lang="scss" scoped>
.status-row {
display: flex;
flex-direction: row;
align-items: center;
&:not(:first-of-type) {
margin-top: 8px;
}
.label {
flex-grow: 1;
}
.indicator {
height: 4px;
border-radius: 4px;
width: 20px;
margin-right: 10px;
}
.percent {
width: 60px;
text-align: right;
}
}
</style>