Skip to content

Commit

Permalink
add kanit font for digga branding in opengraph images
Browse files Browse the repository at this point in the history
  • Loading branch information
maaaathis committed Dec 10, 2023
1 parent b4985be commit d7cc0b7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
14 changes: 13 additions & 1 deletion app/lookup/[domain]/opengraph-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ const interBoldFontP = fetch(
new URL('https://fonts.bunny.net/inter/files/inter-latin-700-normal.woff')
).then((res) => res.arrayBuffer());

const kanitBoldFontP = fetch(
new URL('https://fonts.bunny.net/kanit/files/kanit-latin-800-normal.woff')
).then((res) => res.arrayBuffer());

export const handler = async ({
params,
}: {
params: { domain: string };
}): Promise<ImageResponse> => {
const [interRegularFont, interBoldFont] = await Promise.all([
const [interRegularFont, interBoldFont, kanitBoldFont] = await Promise.all([
interRegularFontP,
interBoldFontP,
kanitBoldFontP,
]);

return new ImageResponse(
Expand All @@ -39,6 +44,7 @@ export const handler = async ({
style={{
fontSize: 32,
color: '#000',
fontWeight: 800,
}}
>
digga
Expand Down Expand Up @@ -73,6 +79,12 @@ export const handler = async ({
style: 'normal',
weight: 700,
},
{
name: 'Kanit',
data: kanitBoldFont,
style: 'normal',
weight: 800,
},
],
}
);
Expand Down
15 changes: 13 additions & 2 deletions app/opengraph-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ const interBoldFontP = fetch(
new URL('https://fonts.bunny.net/inter/files/inter-latin-700-normal.woff')
).then((res) => res.arrayBuffer());

const kanitBoldFontP = fetch(
new URL('https://fonts.bunny.net/kanit/files/kanit-latin-800-normal.woff')
).then((res) => res.arrayBuffer());

export const handler = async () => {
const [interRegularFont, interBoldFont] = await Promise.all([
const [interRegularFont, interBoldFont, kanitBoldFont] = await Promise.all([
interRegularFontP,
interBoldFontP,
kanitBoldFontP,
]);

return new ImageResponse(
Expand All @@ -35,7 +40,7 @@ export const handler = async () => {
style={{
fontSize: 48,
color: '#000',
fontWeight: 700,
fontWeight: 800,
}}
>
digga
Expand Down Expand Up @@ -67,6 +72,12 @@ export const handler = async () => {
style: 'normal',
weight: 700,
},
{
name: 'Kanit',
data: kanitBoldFont,
style: 'normal',
weight: 800,
},
],
}
);
Expand Down

0 comments on commit d7cc0b7

Please sign in to comment.