game-village-politics-frontend/app/components/ui/Bar.vue

23 lines
725 B
Vue
Raw Permalink Normal View History

<script setup lang="ts">
// Tone names stay generic; they map onto the medieval palette.
const props = withDefaults(defineProps<{ value: number; tone?: 'amber' | 'emerald' | 'rose' | 'sky' }>(), {
tone: 'amber',
})
const fill = {
amber: 'bg-gold-500',
emerald: 'bg-moss-600',
rose: 'bg-blood-700',
sky: 'bg-iron-600',
}
const width = computed(() => `${Math.round(Math.min(1, Math.max(0, props.value)) * 100)}%`)
</script>
<!-- A flat fill bar, 0..1, framed like a wooden gauge. -->
<template>
<div class="h-2 w-full overflow-hidden rounded-[2px] border border-wood-700/60 bg-parchment-200">
<div class="h-full transition-[width] duration-300" :class="fill[tone]" :style="{ width }" />
</div>
</template>