Keep day forecast hourly cards readable
This commit is contained in:
@@ -9,13 +9,11 @@ import { ForecastIcon } from "@/components/forecast/forecast-icon";
|
|||||||
import { ForecastSources } from "@/components/forecast/forecast-sources";
|
import { ForecastSources } from "@/components/forecast/forecast-sources";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { useI18n } from "@/lib/i18n";
|
import { useI18n } from "@/lib/i18n";
|
||||||
import { cn } from "@/lib/utils";
|
|
||||||
import {
|
import {
|
||||||
formatForecastRainfall,
|
formatForecastRainfall,
|
||||||
formatForecastTemperature,
|
formatForecastTemperature,
|
||||||
formatForecastWind,
|
formatForecastWind,
|
||||||
getForecastCondition,
|
getForecastCondition,
|
||||||
isForecastHourPast,
|
|
||||||
} from "@/lib/forecast-utils";
|
} from "@/lib/forecast-utils";
|
||||||
import type { DailyForecast, ForecastSource, HourlyForecast } from "@/types/forecast";
|
import type { DailyForecast, ForecastSource, HourlyForecast } from "@/types/forecast";
|
||||||
|
|
||||||
@@ -148,16 +146,11 @@ export function DayForecastModal({
|
|||||||
<h3 className="text-sm font-semibold">{t("forecast.hourlyForDay")}</h3>
|
<h3 className="text-sm font-semibold">{t("forecast.hourlyForDay")}</h3>
|
||||||
<div className="weather-scrollbar -mx-4 mt-4 overflow-x-auto px-4 pb-2 sm:-mx-5 sm:px-5">
|
<div className="weather-scrollbar -mx-4 mt-4 overflow-x-auto px-4 pb-2 sm:-mx-5 sm:px-5">
|
||||||
<ul className="flex min-w-max gap-2">
|
<ul className="flex min-w-max gap-2">
|
||||||
{hours.map((hour) => {
|
{hours.map((hour) => (
|
||||||
const isPast = isForecastHourPast(hour.time);
|
|
||||||
return (
|
|
||||||
<li
|
<li
|
||||||
key={hour.time}
|
key={hour.time}
|
||||||
className={cn(
|
className="w-[5.2rem] rounded-card border border-border/60 bg-surface-muted/55 px-2 py-3 text-center"
|
||||||
"w-[5.2rem] rounded-card border border-border/60 bg-surface-muted/55 px-2 py-3 text-center",
|
title={getForecastCondition(hour.weatherCode, language)}
|
||||||
isPast && "opacity-45",
|
|
||||||
)}
|
|
||||||
title={isPast ? t("forecast.pastHour") : getForecastCondition(hour.weatherCode, language)}
|
|
||||||
>
|
>
|
||||||
<p className="text-xs font-medium text-muted">{formatHour(hour.time)}</p>
|
<p className="text-xs font-medium text-muted">{formatHour(hour.time)}</p>
|
||||||
<ForecastIcon code={hour.weatherCode} className="mx-auto my-3 size-6 text-accent" />
|
<ForecastIcon code={hour.weatherCode} className="mx-auto my-3 size-6 text-accent" />
|
||||||
@@ -167,8 +160,7 @@ export function DayForecastModal({
|
|||||||
{hour.precipitationProbability === null ? "—" : `${hour.precipitationProbability}%`}
|
{hour.precipitationProbability === null ? "—" : `${hour.precipitationProbability}%`}
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
);
|
))}
|
||||||
})}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in New Issue
Block a user