From 5541cb374db7e2f0443343fc3e8409c474a271f0 Mon Sep 17 00:00:00 2001 From: Hyde <108911977+Hyaxon@users.noreply.github.com> Date: Thu, 24 Sep 2026 20:11:35 -0500 Subject: [PATCH 1/3] added sample weather widget based on design --- .../pixel/widgets/weather-placeholder.svg | 6 + src/components/ui/widgets/WeatherWidget.astro | 192 ++++++++++++++++++ src/pages/index.astro | 4 +- 3 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 src/assets/pixel/widgets/weather-placeholder.svg create mode 100644 src/components/ui/widgets/WeatherWidget.astro diff --git a/src/assets/pixel/widgets/weather-placeholder.svg b/src/assets/pixel/widgets/weather-placeholder.svg new file mode 100644 index 0000000..dba4ba6 --- /dev/null +++ b/src/assets/pixel/widgets/weather-placeholder.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/components/ui/widgets/WeatherWidget.astro b/src/components/ui/widgets/WeatherWidget.astro new file mode 100644 index 0000000..c9af3cb --- /dev/null +++ b/src/components/ui/widgets/WeatherWidget.astro @@ -0,0 +1,192 @@ +--- +import placeholder from "../../../assets/pixel/widgets/weather-placeholder.svg"; + +interface Props { + weather: { + city: string; + timezone: string; + observedAt: string; + condition: string; + temperature: number; + high: number; + low: number; + humidity: number | null; + uvIndex: number | null; + airQuality: string | null; + }; + iconSrc?: string; + preview?: boolean; +} + +const { weather, iconSrc = placeholder.src, preview = false } = Astro.props; +const observedAt = new Date(weather.observedAt); +const time = new Intl.DateTimeFormat("en-US", { + timeZone: weather.timezone, + hour: "numeric", + minute: "2-digit", + hour12: true, +}) + .format(observedAt) + .replace(/\s/g, ""); +const fullTime = new Intl.DateTimeFormat("en-US", { + timeZone: weather.timezone, + dateStyle: "medium", + timeStyle: "short", +}).format(observedAt); +--- + +
+
+
+ +

{weather.condition}

+
+ +
+

{weather.city}

+ +

+ {Math.round(weather.temperature)}°F +

+

+ Hi: {Math.round(weather.high)} + Lo: {Math.round(weather.low)} +

+
+ +
+
+
Humidity:
+
+ {weather.humidity === null ? "—" : `${Math.round(weather.humidity)}%`} +
+
+
+
UV Index:
+
{weather.uvIndex === null ? "—" : weather.uvIndex}
+
+
+
+ AQI: +
+
{weather.airQuality ?? "—"}
+
+
+
+ {preview && ( +

Sample weather · Design preview

+ )} +
+ + diff --git a/src/pages/index.astro b/src/pages/index.astro index ab7e537..b79733b 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,6 +1,8 @@ --- import BaseLayout from "../layouts/BaseLayout.astro"; import ClockWidget from "../components/ui/widgets/ClockWidget.astro"; +import WeatherWidget from "../components/ui/widgets/WeatherWidget.astro"; +import { weatherPreview } from "../data/widgets"; import ItemBox from "../components/ui/ItemBox.astro"; import ItemList from "../components/ui/ItemList.astro"; @@ -143,7 +145,7 @@ const homepageProjects = await getHomepageProjects(6);
-

Weather

+
From 6508febd6ad52e660988a0e94b92517427016e51 Mon Sep 17 00:00:00 2001 From: Hyde <108911977+Hyaxon@users.noreply.github.com> Date: Thu, 24 Sep 2026 20:36:19 -0500 Subject: [PATCH 2/3] added weather api info card and attribution --- src/assets/pixel/info.png | Bin 0 -> 487 bytes src/components/ui/widgets/WeatherWidget.astro | 191 +++++++++++++++++- src/pages/index.astro | 2 +- 3 files changed, 181 insertions(+), 12 deletions(-) create mode 100644 src/assets/pixel/info.png diff --git a/src/assets/pixel/info.png b/src/assets/pixel/info.png new file mode 100644 index 0000000000000000000000000000000000000000..9e6c075275236348b61a92636bef2c865ba44279 GIT binary patch literal 487 zcmVg zJ)f$DfI*s3VD7A^`hd%A|62I$H41!BD0XIfjnh8#t$L1!tz+0=e}BE!qJv-^@$n_$ z6_mXeTo|h1Goholhnc5=nC@khagGcFrJky<2@W2{NJzhEhFA@!UtXB|R}eAGM6mPC z(*|&Yblj!{8ypD-fgl1lL$5&e0)QzeEg$fwJGLoFdLCGZ8Wa5i0096091Rmr00006 dNkl + +
+ + +
+

Weather data

+

+ Weather by Open-Meteo. +

+

+ Air quality by CAMS, + via Open-Meteo. +

+

+ Data licensed under{" "} + CC BY 4.0. + Values rounded and conditions formatted for display. +

+ +

Weather data refreshes hourly.

+
+
+
@@ -82,13 +109,161 @@ const fullTime = new Intl.DateTimeFormat("en-US", {
- {preview && ( -

Sample weather · Design preview

- )} + +