-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
21 changed files
with
233 additions
and
247 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
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 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 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 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 +1,2 @@ | ||
Based on examples from https://github.com/vercel/examples/tree/main/edge-functions/vercel-og-nextjs/pages/api | ||
Based on examples from | ||
https://github.com/vercel/examples/tree/main/edge-functions/vercel-og-nextjs/pages/api |
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,2 +1,2 @@ | ||
// This is until https://github.com/netlify/edge-bundler/pull/161 is merged | ||
export { default } from "./custom-font.tsx" | ||
export { default } from "./custom-font.tsx"; |
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,40 +1,39 @@ | ||
/** @jsxImportSource https://esm.sh/react */ | ||
|
||
import { ImageResponse } from '../../mod.ts' | ||
import { ImageResponse } from "../../mod.ts"; | ||
|
||
const font = fetch(new URL('../../assets/TYPEWR__.TTF', import.meta.url)).then( | ||
(res) => res.arrayBuffer() | ||
) | ||
const font = fetch("https://deno.land/x/og_edge@0.0.1/assets/TYPEWR__.TTF") | ||
.then( | ||
(res) => res.arrayBuffer(), | ||
); | ||
|
||
export default async function handler() { | ||
const fontData = await font | ||
const fontData = await font; | ||
|
||
return new ImageResponse( | ||
( | ||
<div | ||
style={{ | ||
backgroundColor: 'white', | ||
height: '100%', | ||
width: '100%', | ||
fontSize: 100, | ||
fontFamily: 'Typewriter', | ||
paddingTop: '100px', | ||
paddingLeft: '50px', | ||
}} | ||
> | ||
Hello world! | ||
</div> | ||
), | ||
<div | ||
style={{ | ||
backgroundColor: "white", | ||
height: "100%", | ||
width: "100%", | ||
fontSize: 100, | ||
fontFamily: "Typewriter", | ||
paddingTop: "100px", | ||
paddingLeft: "50px", | ||
}} | ||
> | ||
Hello world! | ||
</div>, | ||
{ | ||
width: 1200, | ||
height: 630, | ||
fonts: [ | ||
{ | ||
name: 'Typewriter', | ||
name: "Typewriter", | ||
data: fontData, | ||
style: 'normal', | ||
style: "normal", | ||
}, | ||
], | ||
} | ||
) | ||
}, | ||
); | ||
} |
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,2 +1,2 @@ | ||
// This is until https://github.com/netlify/edge-bundler/pull/161 is merged | ||
export { default } from "./dynamic-image.tsx" | ||
export { default } from "./dynamic-image.tsx"; |
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,42 +1,40 @@ | ||
/** @jsxImportSource https://esm.sh/react */ | ||
|
||
import { ImageResponse } from '../../mod.ts' | ||
import { ImageResponse } from "../../mod.ts"; | ||
|
||
export default function handler(req: Request) { | ||
const { searchParams } = new URL(req.url) | ||
const username = searchParams.get('username') | ||
const { searchParams } = new URL(req.url); | ||
const username = searchParams.get("username"); | ||
|
||
return new ImageResponse( | ||
( | ||
<div | ||
<div | ||
style={{ | ||
fontSize: 60, | ||
color: "black", | ||
background: "#f6f6f6", | ||
width: "100%", | ||
height: "100%", | ||
paddingTop: 50, | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
display: "flex", | ||
}} | ||
> | ||
{/* eslint-disable-next-line @next/next/no-img-element */} | ||
<img | ||
alt="avatar" | ||
width="256" | ||
src={`https://github.com/${username || "netlify"}.png`} | ||
style={{ | ||
fontSize: 60, | ||
color: 'black', | ||
background: '#f6f6f6', | ||
width: '100%', | ||
height: '100%', | ||
paddingTop: 50, | ||
flexDirection: 'column', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
display: 'flex', | ||
borderRadius: 128, | ||
}} | ||
> | ||
{/* eslint-disable-next-line @next/next/no-img-element */} | ||
<img | ||
alt="avatar" | ||
width="256" | ||
src={`https://github.com/${username || 'netlify'}.png`} | ||
style={{ | ||
borderRadius: 128, | ||
}} | ||
/> | ||
{username ? <p>github.com/{username}</p> : <p>try /?username=ascorbic</p>} | ||
</div> | ||
), | ||
/> | ||
{username ? <p>github.com/{username}</p> : <p>try /?username=ascorbic</p>} | ||
</div>, | ||
{ | ||
width: 1200, | ||
height: 630, | ||
} | ||
) | ||
}, | ||
); | ||
} |
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,2 +1,2 @@ | ||
// This is until https://github.com/netlify/edge-bundler/pull/161 is merged | ||
export { default } from './emoji.tsx' | ||
export { default } from "./emoji.tsx"; |
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,32 +1,30 @@ | ||
/** @jsxImportSource https://esm.sh/react */ | ||
|
||
import { ImageResponse } from '../../mod.ts' | ||
import { ImageResponse } from "../../mod.ts"; | ||
export default function handler() { | ||
return new ImageResponse( | ||
( | ||
<div | ||
style={{ | ||
fontSize: 100, | ||
color: 'black', | ||
background: 'white', | ||
width: '100%', | ||
height: '100%', | ||
padding: '50px 200px', | ||
textAlign: 'center', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
display: 'flex', | ||
}} | ||
> | ||
👋, 🌎 | ||
</div> | ||
), | ||
<div | ||
style={{ | ||
fontSize: 100, | ||
color: "black", | ||
background: "white", | ||
width: "100%", | ||
height: "100%", | ||
padding: "50px 200px", | ||
textAlign: "center", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
display: "flex", | ||
}} | ||
> | ||
👋, 🌎 | ||
</div>, | ||
{ | ||
width: 1200, | ||
height: 630, | ||
// Supported options: 'twemoji', 'blobmoji', 'noto', 'openmoji', 'fluent', 'fluentFlat' | ||
// Default to 'twemoji' | ||
emoji: 'twemoji', | ||
} | ||
) | ||
emoji: "twemoji", | ||
}, | ||
); | ||
} |
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,2 +1,2 @@ | ||
// This is until https://github.com/netlify/edge-bundler/pull/161 is merged | ||
export { default } from './image-svg.tsx' | ||
export { default } from "./image-svg.tsx"; |
Oops, something went wrong.