|
| 1 | +import { readFileSync } from "node:fs"; |
| 2 | +import { join } from "node:path"; |
| 3 | +import { BRAND_COLOR } from "@/lib/site"; |
| 4 | +import { ImageResponse } from "next/og"; |
| 5 | + |
| 6 | +export const runtime = "nodejs"; |
| 7 | +export const alt = "Resonance — Intuition conference hub"; |
| 8 | +export const size = { width: 1200, height: 630 }; |
| 9 | +export const contentType = "image/png"; |
| 10 | + |
| 11 | +const BG = "#13100c"; |
| 12 | +const CARAMEL = BRAND_COLOR; |
| 13 | +const notch = (file: string) => readFileSync(join(process.cwd(), "src/app/fonts", file)); |
| 14 | + |
| 15 | +function fileDataUri(publicPath: string, mime: string): string | null { |
| 16 | + try { |
| 17 | + const buf = readFileSync(join(process.cwd(), "public", publicPath.replace(/^\//, ""))); |
| 18 | + return `data:${mime};base64,${buf.toString("base64")}`; |
| 19 | + } catch { |
| 20 | + return null; |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | +// Branded Open Graph card for the home page (and any route without its own image). |
| 25 | +export default function Image() { |
| 26 | + const logo = fileDataUri("/brand/resonance/logo.svg", "image/svg+xml"); |
| 27 | + |
| 28 | + return new ImageResponse( |
| 29 | + <div |
| 30 | + style={{ |
| 31 | + display: "flex", |
| 32 | + flexDirection: "column", |
| 33 | + justifyContent: "center", |
| 34 | + width: "100%", |
| 35 | + height: "100%", |
| 36 | + backgroundColor: BG, |
| 37 | + backgroundImage: |
| 38 | + "radial-gradient(1200px 500px at 100% 0%, rgba(224,168,106,0.18), transparent 60%)", |
| 39 | + padding: "70px 80px", |
| 40 | + fontFamily: "Stack Sans Notch", |
| 41 | + }} |
| 42 | + > |
| 43 | + <div style={{ display: "flex", alignItems: "center", gap: 28 }}> |
| 44 | + {logo ? ( |
| 45 | + // biome-ignore lint/a11y/useAltText: OG image (no accessible DOM) |
| 46 | + <img src={logo} width={120} height={120} /> |
| 47 | + ) : null} |
| 48 | + <div style={{ display: "flex", fontSize: 110, fontWeight: 700, color: CARAMEL }}> |
| 49 | + Resonance |
| 50 | + </div> |
| 51 | + </div> |
| 52 | + <div style={{ display: "flex", fontSize: 46, color: "#fff", marginTop: 36 }}> |
| 53 | + The Intuition ecosystem, distilled. |
| 54 | + </div> |
| 55 | + <div |
| 56 | + style={{ |
| 57 | + display: "flex", |
| 58 | + fontSize: 30, |
| 59 | + color: "rgba(255,255,255,0.6)", |
| 60 | + marginTop: 14, |
| 61 | + }} |
| 62 | + > |
| 63 | + Recaps of Spaces, talks & AMAs — context, speakers, themes & missions. |
| 64 | + </div> |
| 65 | + </div>, |
| 66 | + { |
| 67 | + ...size, |
| 68 | + fonts: [ |
| 69 | + { name: "Stack Sans Notch", data: notch("StackSansNotch-SemiBold.ttf"), weight: 600 }, |
| 70 | + { name: "Stack Sans Notch", data: notch("StackSansNotch-Bold.ttf"), weight: 700 }, |
| 71 | + ], |
| 72 | + }, |
| 73 | + ); |
| 74 | +} |
0 commit comments