Skip to content

Commit c6bddb9

Browse files
committed
-
1 parent e45b8d7 commit c6bddb9

File tree

2 files changed

+11
-55
lines changed

2 files changed

+11
-55
lines changed

og/api/image.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const Image = () => {
2+
// @ts-ignore
3+
return <div>Hello World</div>;
4+
};
5+
6+
export default Image;

og/api/og.ts

Lines changed: 5 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,13 @@
11
import { ImageResponse } from '@vercel/og';
2+
import Image from './image';
23

34
export const config = {
45
runtime: 'edge',
56
};
67

78
export default function (_req: Request) {
8-
return new ImageResponse(
9-
{
10-
key: 'docs-page-og',
11-
type: 'div',
12-
props: {
13-
children: [
14-
{
15-
type: 'div',
16-
props: {
17-
style: {
18-
width: '80%',
19-
display: 'flex',
20-
flexDirection: 'column',
21-
textAlign: 'center',
22-
alignItems: 'center',
23-
},
24-
children: [
25-
{
26-
type: 'p',
27-
props: {
28-
style: { fontSize: 32 },
29-
children: 'Docs.Page',
30-
},
31-
},
32-
{
33-
type: 'p',
34-
props: {
35-
style: { fontSize: 64 },
36-
children: 'Title',
37-
},
38-
},
39-
],
40-
},
41-
},
42-
],
43-
style: {
44-
background: 'white',
45-
width: '100%',
46-
height: '100%',
47-
display: 'flex',
48-
textAlign: 'center',
49-
alignItems: 'center',
50-
justifyContent: 'center',
51-
flexDirection: 'column',
52-
backgroundImage:
53-
'radial-gradient(circle at 25px 25px, lightgray 2%, transparent 0%), radial-gradient(circle at 75px 75px, lightgray 2%, transparent 0%)',
54-
backgroundSize: '100px 100px',
55-
},
56-
},
57-
},
58-
{
59-
width: 1200,
60-
height: 600,
61-
},
62-
);
9+
return new ImageResponse(Image(), {
10+
width: 1200,
11+
height: 600,
12+
});
6313
}

0 commit comments

Comments
 (0)