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

22 lines
847 B
Vue
Raw Normal View History

<script setup lang="ts">
defineProps<{
/** Free villagers a level needs as workers (the server's `villagers`); nothing shows at 0. */
villagers?: number
/** The village's free villagers (`population.idle`): the count turns red above it. */
idle?: number
}>()
</script>
<!-- The villagers a level needs, next to its cost: a small villager icon and the number. -->
<template>
<span
v-if="villagers"
class="inline-flex items-center gap-1 text-xs tabular-nums whitespace-nowrap"
:class="idle !== undefined && villagers > idle ? 'font-semibold text-blood-700' : 'text-ink-700'"
:title="$t('village.build.villagers_title', { need: villagers, idle: idle ?? '–' })"
>
<IconUi name="users" class="size-4" :class="idle !== undefined && villagers > idle ? '' : 'text-wood-800'" />
{{ villagers }}
</span>
</template>