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); +--- + +
+ + 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
+