Skip to content

Instantly share code, notes, and snippets.

@jasikpark
Created June 27, 2025 17:12
Show Gist options
  • Save jasikpark/3af741a15ce91efffa1364e772a77017 to your computer and use it in GitHub Desktop.
Save jasikpark/3af741a15ce91efffa1364e772a77017 to your computer and use it in GitHub Desktop.
Postcards page
export const getPostcards = async () => {
const files = import.meta.glob<ImageMetadata>(
"/src/assets/postcard-images/*.{jpeg,jpg,JPG,png,gif}",
{ import: "default", eager: true }
);
const featuredFiles = import.meta.glob<ImageMetadata>(
"/src/assets/featured-postcard-images/*.{jpeg,jpg,JPG,png,gif}",
{import: "default", eager: true }
);
return {...featuredFiles, ...files} as Record<string, ImageMetadata>;
};
---
import BaseHead from "@/components/BaseHead.astro";
import Link from "@/components/HeaderLink.astro";
import Header from "@/components/Header.astro";
import Footer from "@/components/Footer.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../../consts";
import { Picture } from "astro:assets";
import { getPostcards } from "./_getPostcards";
import Card from "../../components/Card.astro";
import "@fontsource/oleo-script-swash-caps";
const postcards = await getPostcards();
---
<!doctype html>
<html lang="en">
<head>
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
</head>
<body class="p-0 m-0 max-w-screen">
<Header />
<main class="container mx-auto md:px-10">
<section class="flex flex-col text-center gap-4 " >
<p class="text-pblack">Postcards from the community</p>
<h2>What is your vision for Montrose Boulevard?</h2>
<article class="full-bleed">
<div class="full-bleed wrapper">
{
Object.entries(postcards).map(([id, image], idx) => (
<>
{idx % 100 === 0 && idx > 0 ? <h2 class="text-9xl">{idx}'s</h2> : null}
<Picture
class="max-w-full"
layout="responsive"
priority={idx < 100}
src={image}
width={625}
// TODO: replace alt txt w/ the actual postcard text??
alt={`Postcard #${idx}`}
// Enable the lightbox for this postcard
hotfx-lightbox-slide
/></>
))
}
</div>
<Link class="go-to-top-button bg-pgreen px-5 py-3 border-1 border-black rounded-lg shadow-card hover:shadow-hover transition" href="#" text="Return to top 👆" style="primary" />
</article>
</section>
<!-- <WhatIDo /> -->
</main>
<Footer />
</body>
</html>
<script>
// Load the web component
import "@hot-page/hotfx-lightbox"
</script>
<style>
.wrapper {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
justify-items: center;
gap: 2rem;
}
.go-to-top-button {
position: fixed;
bottom: 1.5rem;
right: 3rem;
}
:global(html) {
scroll-behavior: smooth;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment