@@ -5,68 +5,124 @@ export const runtime = 'edge';
55
66export async function GET ( req : NextRequest ) {
77 const { searchParams } = new URL ( req . url ) ;
8+ const type = searchParams . get ( 'type' ) ;
89
9- // ?title=<title>
10- const hasTitle = searchParams . has ( 'title' ) ;
11- const title = hasTitle
12- ? searchParams . get ( 'title' ) ?. slice ( 0 , 100 )
13- : 'Snow Leopard' ;
10+ if (
11+ type === 'post' &&
12+ searchParams . has ( 'title' ) &&
13+ searchParams . has ( 'author' ) &&
14+ searchParams . has ( 'date' )
15+ ) {
16+ const title = searchParams . get ( 'title' ) ?. slice ( 0 , 100 ) ?? 'Untitled' ;
17+ const author = searchParams . get ( 'author' ) ?. slice ( 0 , 50 ) ?? 'Anonymous' ;
18+ const date = searchParams . get ( 'date' ) ?? '' ;
19+
20+ return new ImageResponse (
21+ (
22+ < div
23+ style = { {
24+ width : '100%' ,
25+ height : '100%' ,
26+ display : 'flex' ,
27+ flexDirection : 'column' ,
28+ background : 'white' ,
29+ padding : '60px' ,
30+ fontFamily : '"SF Pro Display", "Helvetica Neue", "Arial", sans-serif' ,
31+ position : 'relative' ,
32+ } }
33+ >
34+ < div
35+ style = { {
36+ position : 'absolute' ,
37+ top : 60 ,
38+ left : 60 ,
39+ fontSize : 28 ,
40+ fontWeight : 500 ,
41+ color : '#1f2937' ,
42+ } }
43+ >
44+ snow leopard
45+ </ div >
46+ < div
47+ style = { {
48+ display : 'flex' ,
49+ flexDirection : 'column' ,
50+ justifyContent : 'center' ,
51+ alignItems : 'center' ,
52+ flexGrow : 1 ,
53+ paddingTop : 80 ,
54+ } }
55+ >
56+ < div
57+ style = { {
58+ fontSize : 72 ,
59+ fontWeight : 800 ,
60+ color : '#1f2937' ,
61+ lineHeight : 1.1 ,
62+ maxWidth : '95%' ,
63+ textAlign : 'center' ,
64+ } }
65+ >
66+ { title }
67+ </ div >
68+ < div
69+ style = { {
70+ display : 'flex' ,
71+ alignItems : 'center' ,
72+ marginTop : 32 ,
73+ fontSize : 32 ,
74+ fontWeight : 400 ,
75+ color : '#6b7280' ,
76+ } }
77+ >
78+ < span > { author } </ span >
79+ < span style = { { margin : '0 12px' } } > •</ span >
80+ < span > { date } </ span >
81+ </ div >
82+ </ div >
83+ </ div >
84+ ) ,
85+ { width : 1200 , height : 630 }
86+ ) ;
87+ }
1488
1589 return new ImageResponse (
1690 (
17- < div style = { {
18- width : 1200 ,
19- height : 630 ,
20- display : 'flex' ,
21- alignItems : 'center' ,
22- justifyContent : 'center' ,
23- background : 'radial-gradient(circle at center, #ffffff 60%, #f0f0f0 100%)' , // floating backdrop
24- } } >
25- < div style = { {
26- width : 600 ,
27- height : 600 ,
28- borderRadius : '50%' ,
29- background : 'radial-gradient(circle at center, #f9f9f9 0%, #e0e0e0 100%)' ,
30- border : '8px solid #c0c0c0' , // silver border
31- boxShadow : '0 20px 40px rgba(0,0,0,0.15), inset 0 0 30px rgba(0,0,0,0.03)' , // drop shadow for floating effect
32- fontFamily : '"SF Pro Display", "Helvetica Neue", "Arial", sans-serif' ,
33- position : 'relative' ,
91+ < div
92+ style = { {
93+ width : '100%' ,
94+ height : '100%' ,
3495 display : 'flex' ,
3596 flexDirection : 'column' ,
3697 alignItems : 'center' ,
3798 justifyContent : 'center' ,
38- } } >
39- < div style = { {
40- fontSize : 72 ,
41- fontWeight : 800 ,
99+ background : 'white' ,
100+ fontFamily : '"SF Pro Display", "Helvetica Neue", "Arial", sans-serif' ,
101+ padding : '60px' ,
102+ } }
103+ >
104+ < div
105+ style = { {
106+ fontSize : 84 ,
107+ fontWeight : 500 ,
42108 letterSpacing : '-0.05em' ,
43- lineHeight : 1 ,
44- textAlign : 'center' ,
45- fontFamily : '"SF Pro Display", "Helvetica Neue", "Arial", sans-serif' ,
46- color : '#1f2937' , // gray-800
47- } } >
48- { title }
49- </ div >
50- < div style = { {
51- fontSize : 28 ,
52- fontWeight : 400 ,
109+ color : '#1f2937' ,
110+ } }
111+ >
112+ Snow Leopard
113+ </ div >
114+ < div
115+ style = { {
116+ fontSize : 32 ,
53117 marginTop : 24 ,
54- color : '#6b7280' , // gray-500
55- textAlign : 'center' ,
56- fontFamily : '"SF Pro Display", "Helvetica Neue", "Arial", sans-serif' ,
57- } } >
58- Tab, Tab, Apply
59- </ div >
60- < div style = { {
61- fontSize : 28 ,
62118 fontWeight : 400 ,
63- marginTop : 8 ,
64119 color : '#6b7280' ,
65120 textAlign : 'center' ,
66- fontFamily : '"SF Pro Display", "Helvetica Neue", "Arial", sans-serif' ,
67- } } >
68- Brilliance
69- </ div >
121+ maxWidth : '75%' ,
122+ lineHeight : 1.4 ,
123+ } }
124+ >
125+ The most satisfying, intuitive AI writing tool, and it's open source.
70126 </ div >
71127 </ div >
72128 ) ,
0 commit comments