From 60bd2cce969e1fd68a6b8ed02b17c1472223f5e0 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Fri, 18 Apr 2025 15:24:05 +0200 Subject: [PATCH] update opengraph image generator --- web/src/app/icons/[icon]/opengraph-image.tsx | 431 +++++++++---------- 1 file changed, 203 insertions(+), 228 deletions(-) diff --git a/web/src/app/icons/[icon]/opengraph-image.tsx b/web/src/app/icons/[icon]/opengraph-image.tsx index 6c3f8911..de91a167 100644 --- a/web/src/app/icons/[icon]/opengraph-image.tsx +++ b/web/src/app/icons/[icon]/opengraph-image.tsx @@ -25,14 +25,14 @@ export default async function Image({ params }: { params: { icon: string } }) { // Format the icon name for display const formattedIconName = icon - .split("-") - .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(" ") - + .split("-") + .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) + .join(" ") + // Get the icon URL // Check if the image exists if the return type of the image is of image type - try { - const response = await fetch(iconUrl) + try { + const response = await fetch(iconUrl) if (!response.ok) { console.error(`Icon ${icon} was not found at ${iconUrl}`) iconUrl = `https://placehold.co/600x400?text=${formattedIconName}` @@ -41,236 +41,211 @@ export default async function Image({ params }: { params: { icon: string } }) { console.error(`Icon ${icon} was not found at ${iconUrl}`) iconUrl = `https://placehold.co/600x400?text=${formattedIconName}` } - return new ImageResponse(
- {/* Background with gradient */} -
+ style={{ + display: "flex", + width: "100%", + height: "100%", + position: "relative", + fontFamily: "Inter, system-ui, sans-serif", + overflow: "hidden", + backgroundColor: "white", + backgroundImage: + "radial-gradient(circle at 25px 25px, lightgray 2%, transparent 0%), radial-gradient(circle at 75px 75px, lightgray 2%, transparent 0%)", + backgroundSize: "100px 100px", + }} + > + {/* Background blur blobs */} +
+
- {/* Subtle pattern overlay */} -
+ {/* Main content layout */} +
+ {/* Icon container */} +
+
+ {formattedIconName} +
- {/* Decorative elements */} -
-
+ {/* Text content */} +
+
+ Download {formattedIconName} icon for free +
- {/* Content container - horizontal layout */} -
- {/* Left side - Icon container with enhanced styling */} -
- {/* Subtle gradient in icon background */} -
+
+ Amongst {totalIcons} other high-quality dashboard icons +
- {/* Icon image */} - {formattedIconName} -
+
+ {["SVG", "PNG", "WEBP"].map((format) => ( +
+ {format} +
+ ))} +
+
+
- {/* Right side - Text content with improved typography */} -
- {/* Main title with enhanced styling */} -
- Download {formattedIconName} icon for free -
- - {/* Subtitle with improved styling */} -
- Amongst {totalIcons.toLocaleString()} other high-quality dashboard icons -
- - {/* Format badges */} -
- {["SVG", "PNG", "WEBP"].map((format) => ( -
- {format} -
- ))} -
-
-
- - {/* Footer with enhanced branding */} -
-
-
- dashboardicons.com -
-
-
, + {/* Footer */} +
+
+
+ dashboardicons.com +
+
+
, { ...size, },