Files

26 lines
1004 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">
import { iconCloud, iconSunny } from '@sit-onyx/icons'
import type { DailyWeather } from '#shared/insights'
import { formatShortDate, formatWeekdayShort } from '~/utils/format'
const props = defineProps<{
days: DailyWeather[]
}>()
function iconFor(kind: DailyWeather['kind']) {
return kind === 'sunny' || kind === 'partly-cloudy' ? iconSunny : iconCloud
}
</script>
<template>
<div class="weather-strip" role="list" aria-label="Weather forecast for the plan week">
<div v-for="day in props.days" :key="day.date" class="weather-day" role="listitem">
<strong>{{ formatWeekdayShort(day.date) }} {{ formatShortDate(day.date) }}</strong>
<OnyxIcon :icon="iconFor(day.kind)" size="24px" color="primary" />
<span>{{ Math.round(day.tempMin) }}–{{ Math.round(day.tempMax) }} °C</span>
<span class="muted">{{ day.precipMm.toFixed(1) }} mm</span>
<span class="muted">{{ Math.round(day.cloudPct) }}% cloud</span>
</div>
</div>
</template>