Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix og logos (#840)

PickleNikc80f14e21f7e
diff --git a/apps/og-image/app/api/challenge/route.tsx b/apps/og-image/app/api/challenge/route.tsx
index da0164a2..141732a4 100644
--- a/apps/og-image/app/api/challenge/route.tsx
+++ b/apps/og-image/app/api/challenge/route.tsx
@@ -69,16 +69,8 @@ export async function GET(req: Request) {
<div tw="flex absolute top-10 right-10">
<Logo3d />
</div>
-
- <p tw="flex items-center -mt-3">
- <p tw="text-2xl font-bold bg-zinc-600 rounded-full px-3 py-1.5">
- <span>@</span>
- <span>{props.username}</span>
- </p>
- <p tw="text-2xl ml-4">{props.date}</p>
- </p>
<h1
- tw="text-7xl font-bold truncate pr-48 -mt-2 overflow-ellipsis"
+ tw="text-7xl truncate pr-48 mt-0 overflow-ellipsis"
style={{ fontWeight: '800 !important' }}
>
{props.title === null ? null : props.title.split(' | ')[0]}
@@ -87,10 +79,15 @@ export async function GET(req: Request) {
<p
tw={`${
COLORS_BY_DIFFICULTY[props.difficulty]
- } text-black font-bold text-2xl px-6 py-1.5 rounded-full`}
+ } text-black font-bold text-2xl rounded-full px-6 py-1.5 mb-0`}
>
{props.difficulty}
</p>
+ <p tw="bg-zinc-600 font-bold text-2xl rounded-full px-3 pt-1.5 pb-2 ml-4 mb-0">
+ <span>@</span>
+ <span>{props.username}</span>
+ </p>
+ <p tw="text-2xl ml-4 mb-0">{props.date}</p>
</p>
<p tw="text-3xl text-zinc-300">{props.description}</p>
</div>
diff --git a/apps/og-image/app/api/user/route.tsx b/apps/og-image/app/api/user/route.tsx
index 83881c37..2051aeeb 100644
--- a/apps/og-image/app/api/user/route.tsx
+++ b/apps/og-image/app/api/user/route.tsx
@@ -1,10 +1,18 @@
import { ImageResponse } from '@vercel/og';
-import { Logo } from 'app/components/logo';
import { userParam } from 'utils/zodParams';
+import { fetchFont } from 'utils/fetchFont';
+import { Grid } from 'app/components/grid';
+import { Logo } from 'app/components/logo';
export const runtime = 'edge';
export async function GET(req: Request) {
+ const [inter900, inter700, inter400] = await Promise.all([
+ fetchFont('Inter', 900),
+ fetchFont('Inter', 700),
+ fetchFont('Inter', 400),
+ ]);
+
const parsed = userParam.decodeRequest(req);
if (!parsed.success) {
@@ -15,11 +23,12 @@ export async function GET(req: Request) {
return new ImageResponse(
(
- <div tw="bg-zinc-900 h-full w-full text-white flex flex-col p-14">
- <div tw="flex flex-col justify-center items-center w-full h-full">
+ <div tw="bg-black h-full w-full text-white bg-cover flex flex-col px-32 py-14">
+ <Grid />
+ <div tw="flex flex-col justify-center items-center text-center h-full w-full">
<Logo />
- <h1 tw="text-6xl pt-3">{props.username}</h1>
- <p tw="text-center text-3xl text-zinc-300">
+ <h1 tw="text-6xl pt-3 font-bold mt-6">{props.username}</h1>
+ <p tw="text-3xl text-zinc-300">
A user that we can prolly pull data from the db or at least their avatar maybe?
</p>
</div>
@@ -28,6 +37,11 @@ export async function GET(req: Request) {
{
width: 1200,
height: 600,
+ fonts: [
+ { name: 'Inter', data: inter900, weight: 900 },
+ { name: 'Inter', data: inter700, weight: 700 },
+ { name: 'Inter', data: inter400, weight: 400 },
+ ],
},
);
}
diff --git a/apps/og-image/app/components/logo.tsx b/apps/og-image/app/components/logo.tsx
index 6641328d..45350d45 100644
--- a/apps/og-image/app/components/logo.tsx
+++ b/apps/og-image/app/components/logo.tsx
@@ -1,8 +1,8 @@
export function Logo() {
return (
<svg
- height="144"
width="144"
+ height="144"
viewBox="0 0 512 512"
fill="none"
xmlns="http://www.w3.org/2000/svg"
@@ -14,7 +14,7 @@ export function Logo() {
<path
fill-rule="evenodd"
clip-rule="evenodd"
- d="M211.466 282.064H269.474V262.295V242.526H107.789V282.064H165.513V458.105H211.466V282.064Z"
+ d="M211.466 282.064H269.474V242.526H107.789V282.064H165.513V458.105H211.466V282.064Z"
fill="white"
/>
<path
diff --git a/apps/og-image/app/components/logo3d.tsx b/apps/og-image/app/components/logo3d.tsx
index 2a645771..3893d95f 100644
--- a/apps/og-image/app/components/logo3d.tsx
+++ b/apps/og-image/app/components/logo3d.tsx
@@ -3,30 +3,33 @@ export function Logo3d() {
<svg
width="144"
height="144"
- viewBox="0 0 638 638"
+ viewBox="0 0 633 633"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
- <g filter="url(#filter0_ii_284_103)">
- <rect width="637.029" height="637.029" rx="68.1096" fill="#3178C6" />
+ <g filter="url(#filter0_ii_1050_32)">
+ <path
+ d="M0 74.9605C0 33.561 33.561 0 74.9605 0H558.039C599.439 0 633 33.561 633 74.9605V558.039C633 599.439 599.439 633 558.039 633H74.9605C33.561 633 0 599.439 0 558.039V74.9605Z"
+ fill="#3178C6"
+ />
+ <path
+ fill-rule="evenodd"
+ clip-rule="evenodd"
+ d="M261.441 348.723H333.158V299.842H133.263V348.723H204.629V566.368H261.441V348.723Z"
+ fill="white"
+ />
+ <path
+ d="M366.474 566.368V299.842H423.962V410.298H508.741V299.842H566.368V566.368H508.741V455.523H423.962V566.368H366.474Z"
+ fill="white"
+ />
</g>
- <path
- fill-rule="evenodd"
- clip-rule="evenodd"
- d="M243.77 314.169H318.615V288.585V263H110V314.169H184.479V542H243.77V314.169Z"
- fill="white"
- />
- <path
- d="M353.385 542V263H413.381V378.626H501.858V263H562V542H501.858V425.967H413.381V542H353.385Z"
- fill="white"
- />
<defs>
<filter
- id="filter0_ii_284_103"
+ id="filter0_ii_1050_32"
x="-49"
y="-49"
- width="736.029"
- height="736.029"
+ width="732"
+ height="732"
filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB"
>
@@ -42,7 +45,7 @@ export function Logo3d() {
<feGaussianBlur stdDeviation="74.5" />
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" />
- <feBlend mode="normal" in2="shape" result="effect1_innerShadow_284_103" />
+ <feBlend mode="normal" in2="shape" result="effect1_innerShadow_1050_32" />
<feColorMatrix
in="SourceAlpha"
type="matrix"
@@ -55,8 +58,8 @@ export function Logo3d() {
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.12 0" />
<feBlend
mode="normal"
- in2="effect1_innerShadow_284_103"
- result="effect2_innerShadow_284_103"
+ in2="effect1_innerShadow_1050_32"
+ result="effect2_innerShadow_1050_32"
/>
</filter>
</defs>
diff --git a/apps/og-image/public/og.png b/apps/og-image/public/og.png
index 4947a287..ad9e03ad 100644
Binary files a/apps/og-image/public/og.png and b/apps/og-image/public/og.png differ