-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
7e46fb4
commit b418484
Showing
8 changed files
with
89 additions
and
215 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
File renamed without changes.
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,86 @@ | ||
import { NextraLogo } from '@components/icons' | ||
import { ImageResponse } from 'next/og' | ||
|
||
export const runtime = 'edge' | ||
|
||
const font = fetch(new URL('./Inter-SemiBold.otf', import.meta.url)).then(res => | ||
res.arrayBuffer() | ||
) | ||
|
||
export async function GET(req: Request): Promise<Response> { | ||
try { | ||
const { searchParams } = new URL(req.url) | ||
|
||
// ?title=<title> | ||
const title = | ||
searchParams.get('title')?.slice(0, 100) || 'Nextra Documentation' | ||
|
||
return new ImageResponse( | ||
( | ||
<div | ||
style={{ | ||
height: '100%', | ||
width: '100%', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'flex-start', | ||
justifyContent: 'center', | ||
padding: 80, | ||
backgroundColor: '#030303', | ||
backgroundImage: | ||
'radial-gradient(circle at 25px 25px, #333 2%, transparent 0%), radial-gradient(circle at 75px 75px, #333 2%, transparent 0%)', | ||
backgroundSize: '100px 100px', | ||
backgroundPosition: '-30px -10px', | ||
fontWeight: 600, | ||
color: 'white' | ||
}} | ||
> | ||
<NextraLogo | ||
style={{ position: 'absolute', top: 70, left: 80 }} | ||
height="40" | ||
/> | ||
<p | ||
style={{ | ||
position: 'absolute', | ||
bottom: 70, | ||
left: 80, | ||
margin: 0, | ||
fontSize: 30, | ||
letterSpacing: -1 | ||
}} | ||
> | ||
Create beautiful websites with Next.js & MDX. | ||
</p> | ||
<h1 | ||
style={{ | ||
fontSize: 82, | ||
margin: '0 0 40px -2px', | ||
lineHeight: 1.1, | ||
textShadow: '0 2px 30px #000', | ||
letterSpacing: -4, | ||
backgroundImage: 'linear-gradient(90deg, #fff 40%, #aaa)', | ||
backgroundClip: 'text', | ||
color: 'transparent' | ||
}} | ||
> | ||
{title} | ||
</h1> | ||
</div> | ||
), | ||
{ | ||
width: 1200, | ||
height: 630, | ||
fonts: [ | ||
{ | ||
name: 'inter', | ||
data: await font, | ||
style: 'normal' | ||
} | ||
] | ||
} | ||
) | ||
} catch (error) { | ||
console.error(error) | ||
return new Response('Failed to generate the image', { status: 500 }) | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.