chore: add prettier formatting
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s
This commit is contained in:
@@ -4,7 +4,13 @@ import Link from "next/link";
|
||||
import { motion } from "framer-motion";
|
||||
import { Droplets, Gauge, Heart, Wind } from "lucide-react";
|
||||
import { useWeatherStore } from "@/lib/store";
|
||||
import { formatHumidity, formatPressure, formatTemperature, formatWind, getWeatherMoodFromData } from "@/lib/weather-utils";
|
||||
import {
|
||||
formatHumidity,
|
||||
formatPressure,
|
||||
formatTemperature,
|
||||
formatWind,
|
||||
getWeatherMoodFromData,
|
||||
} from "@/lib/weather-utils";
|
||||
import type { SynopStation } from "@/types/imgw";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -23,24 +29,56 @@ export function StationCard({ station, index = 0 }: { station: SynopStation; ind
|
||||
const mood = getWeatherMoodFromData(station);
|
||||
const compactWind = station.windSpeed === null ? "—" : formatWind(station.windSpeed, null, language, windSpeedUnit);
|
||||
return (
|
||||
<motion.div initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: Math.min(index * 0.025, 0.3), duration: 0.3 }}>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 10 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ delay: Math.min(index * 0.025, 0.3), duration: 0.3 }}
|
||||
>
|
||||
<Card className="group relative h-full overflow-hidden p-4 transition duration-300 hover:-translate-y-1 hover:bg-surface-raised/90">
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<Link href={`/station/${station.id}`} onClick={() => selectStation(station.id)} className="min-w-0 flex-1 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent">
|
||||
<Link
|
||||
href={`/station/${station.id}`}
|
||||
onClick={() => selectStation(station.id)}
|
||||
className="min-w-0 flex-1 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
|
||||
>
|
||||
<p className="truncate text-sm font-semibold">{station.name}</p>
|
||||
<p className="mt-3 text-4xl font-light tracking-[-0.08em]">{formatTemperature(station.temperature, language, temperatureUnit)}</p>
|
||||
<p className="mt-3 text-4xl font-light tracking-[-0.08em]">
|
||||
{formatTemperature(station.temperature, language, temperatureUnit)}
|
||||
</p>
|
||||
</Link>
|
||||
<div className="flex flex-col items-end gap-2">
|
||||
<WeatherIcon mood={mood} className="size-9 text-accent" />
|
||||
<Button variant="ghost" className="size-8 p-0" aria-label={favorite ? t("favorites.removeStation", { name: station.name }) : t("favorites.addStation", { name: station.name })} onClick={() => toggleFavorite(station.id)}>
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="size-8 p-0"
|
||||
aria-label={
|
||||
favorite
|
||||
? t("favorites.removeStation", { name: station.name })
|
||||
: t("favorites.addStation", { name: station.name })
|
||||
}
|
||||
onClick={() => toggleFavorite(station.id)}
|
||||
>
|
||||
<Heart className={cn("size-4", favorite && "fill-rose-500 text-rose-500")} />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<Link href={`/station/${station.id}`} onClick={() => selectStation(station.id)} className="mt-4 grid grid-cols-3 gap-2 rounded-lg text-[0.68rem] text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent">
|
||||
<span className="flex items-center gap-1"><Droplets className="size-3" />{formatHumidity(station.humidity, language)}</span>
|
||||
<span className="flex items-center gap-1"><Wind className="size-3" />{compactWind}</span>
|
||||
<span className="flex items-center gap-1"><Gauge className="size-3" />{station.pressure === null ? "—" : formatPressure(station.pressure, language).split(" ")[0]}</span>
|
||||
<Link
|
||||
href={`/station/${station.id}`}
|
||||
onClick={() => selectStation(station.id)}
|
||||
className="mt-4 grid grid-cols-3 gap-2 rounded-lg text-[0.68rem] text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
|
||||
>
|
||||
<span className="flex items-center gap-1">
|
||||
<Droplets className="size-3" />
|
||||
{formatHumidity(station.humidity, language)}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<Wind className="size-3" />
|
||||
{compactWind}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<Gauge className="size-3" />
|
||||
{station.pressure === null ? "—" : formatPressure(station.pressure, language).split(" ")[0]}
|
||||
</span>
|
||||
</Link>
|
||||
</Card>
|
||||
</motion.div>
|
||||
|
||||
Reference in New Issue
Block a user