-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
daa583c
commit 824ccc0
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { ImageResponse } from 'next/og' | ||
|
||
// Route segment config | ||
export const runtime = 'edge' | ||
|
||
// Image metadata | ||
export const alt = 'Moon Landing page' | ||
export const size = { | ||
width: 1200, | ||
height: 630, | ||
} | ||
|
||
export const contentType = 'image/png' | ||
|
||
// Image generation | ||
export default async function Image() { | ||
// Font | ||
const interSemiBold = fetch( | ||
new URL('./Inter-SemiBold.ttf', import.meta.url) | ||
).then((res) => res.arrayBuffer()) | ||
|
||
return new ImageResponse( | ||
( | ||
// ImageResponse JSX element | ||
<div | ||
style={{ | ||
fontSize: 128, | ||
backgroundImage: `url('https://raw.githubusercontent.com/Frankothe196/moon-mission-landing-page/main/app-screenshot.png')`, | ||
backgroundPosition: 'center', | ||
backgroundSize:'cover', | ||
width: '100%', | ||
height: '100%', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
Moon Landing Page Concept | ||
</div> | ||
), | ||
// ImageResponse options | ||
{ | ||
// For convenience, we can re-use the exported opengraph-image | ||
// size config to also set the ImageResponse's width and height. | ||
...size, | ||
fonts: [ | ||
{ | ||
name: 'Inter', | ||
data: await interSemiBold, | ||
style: 'normal', | ||
weight: 400, | ||
}, | ||
], | ||
} | ||
) | ||
} |