All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m2s
Co-authored-by: Cursor <cursoragent@cursor.com>
89 lines
1.7 KiB
Vue
89 lines
1.7 KiB
Vue
<template>
|
|
<div class="wk-rates">
|
|
<p v-if="title" class="wk-rates__title">{{ title }}</p>
|
|
<div class="wk-rates__list">
|
|
<div v-for="item in items" :key="item.key" class="wk-rates__row">
|
|
<div class="wk-rates__meta">
|
|
<span class="wk-rates__label">{{ item.label }}</span>
|
|
<span class="wk-rates__value">{{ formatPct(item.value) }}</span>
|
|
</div>
|
|
<div class="wk-rates__track" aria-hidden="true">
|
|
<div class="wk-rates__fill" :style="{ width: `${clampPct(item.value)}%` }" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
export type RateBarItem = {
|
|
key: string
|
|
label: string
|
|
value: number
|
|
}
|
|
|
|
defineProps<{
|
|
title?: string
|
|
items: RateBarItem[]
|
|
}>()
|
|
|
|
function clampPct(n: number) {
|
|
const v = Number(n) || 0
|
|
if (v < 0) return 0
|
|
if (v > 100) return 100
|
|
return Math.round(v * 10) / 10
|
|
}
|
|
|
|
function formatPct(n: number) {
|
|
return `${clampPct(n)}%`
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.wk-rates__title {
|
|
margin: 0 0 8px;
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
color: rgba(26, 46, 56, 0.72);
|
|
}
|
|
|
|
.wk-rates__list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
}
|
|
|
|
.wk-rates__meta {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 8px;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.wk-rates__label {
|
|
font-size: 12px;
|
|
color: rgba(26, 46, 56, 0.62);
|
|
}
|
|
|
|
.wk-rates__value {
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
color: #1a2e38;
|
|
}
|
|
|
|
.wk-rates__track {
|
|
height: 8px;
|
|
border-radius: 999px;
|
|
background: rgba(15, 23, 42, 0.06);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.wk-rates__fill {
|
|
height: 100%;
|
|
border-radius: inherit;
|
|
background: var(--app-primary-color);
|
|
transition: width 0.25s ease;
|
|
}
|
|
</style>
|