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

22 lines
847 B
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>