26 lines
1004 B
Vue
26 lines
1004 B
Vue
<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>
|