@@ -33,34 +33,6 @@ function OpenGraph({
3333 : props . description
3434 : ''
3535
36- const Corner = ( {
37- position,
38- path,
39- } : {
40- position : React . CSSProperties
41- path : string
42- } ) => (
43- < svg
44- style = { {
45- position : 'absolute' ,
46- width : corner . length ,
47- height : corner . length ,
48- pointerEvents : 'none' ,
49- ...position ,
50- } }
51- viewBox = { `0 0 ${ corner . length } ${ corner . length } ` }
52- >
53- < path
54- d = { path }
55- fill = 'none'
56- stroke = { `${ mutedColor } 40` }
57- strokeWidth = { corner . strokeWidth }
58- strokeLinecap = 'round'
59- strokeLinejoin = 'round'
60- />
61- </ svg >
62- )
63-
6436 return (
6537 < div
6638 style = { {
@@ -71,7 +43,7 @@ function OpenGraph({
7143 backgroundColor : '#000000' ,
7244
7345 display : 'flex' ,
74- justifyContent : 'space-between' ,
46+ justifyContent : isImageOnly ? 'center' : 'space-between' ,
7547 alignItems : 'center' ,
7648 gap : '2.5rem' ,
7749 ...props . style ,
@@ -99,21 +71,29 @@ function OpenGraph({
9971 />
10072
10173 < Corner
74+ corner = { corner }
75+ color = { mutedColor }
10276 position = { { top : corner . margin , left : corner . margin } }
10377 path = { `M ${ corner . length } ${ s } L ${ s } ${ s } L ${ s } ${ corner . length } ` }
10478 />
10579
10680 < Corner
81+ corner = { corner }
82+ color = { mutedColor }
10783 position = { { top : corner . margin , right : corner . margin } }
10884 path = { `M 0 ${ s } L ${ max } ${ s } L ${ max } ${ corner . length } ` }
10985 />
11086
11187 < Corner
88+ corner = { corner }
89+ color = { mutedColor }
11290 position = { { bottom : corner . margin , left : corner . margin } }
11391 path = { `M ${ s } 0 L ${ s } ${ max } L ${ corner . length } ${ max } ` }
11492 />
11593
11694 < Corner
95+ corner = { corner }
96+ color = { mutedColor }
11797 position = { { bottom : corner . margin , right : corner . margin } }
11898 path = { `M ${ max } 0 L ${ max } ${ max } L 0 ${ max } ` }
11999 />
@@ -203,9 +183,8 @@ function OpenGraph({
203183 style = { {
204184 flexShrink : 0 ,
205185 display : 'flex' ,
206- width : isImageOnly ? '560px' : '400px' ,
207- height : isImageOnly ? '315px' : '400px' ,
208- border : `1px solid ${ primaryColor } 80` ,
186+ width : isImageOnly ? '920px' : '400px' ,
187+ height : isImageOnly ? '518px' : '400px' ,
209188 borderRadius : '1rem' ,
210189 overflow : 'hidden' ,
211190 } }
@@ -215,7 +194,7 @@ function OpenGraph({
215194 src = { props . image }
216195 alt = { props . title }
217196 style = { {
218- objectFit : 'cover' ,
197+ objectFit : isImageOnly ? 'contain' : 'cover' ,
219198 width : '100%' ,
220199 height : '100%' ,
221200 borderRadius : '1rem' ,
@@ -248,3 +227,35 @@ function OpenGraph({
248227}
249228
250229export { OpenGraph }
230+
231+ const Corner = ( {
232+ corner,
233+ color,
234+ position,
235+ path,
236+ } : {
237+ corner : Required < OpenGraphProps [ 'corner' ] >
238+ color : string
239+ position : React . CSSProperties
240+ path : string
241+ } ) => (
242+ < svg
243+ style = { {
244+ position : 'absolute' ,
245+ width : corner ?. length ,
246+ height : corner ?. length ,
247+ pointerEvents : 'none' ,
248+ ...position ,
249+ } }
250+ viewBox = { `0 0 ${ corner ?. length } ${ corner ?. length } ` }
251+ >
252+ < path
253+ d = { path }
254+ fill = 'none'
255+ stroke = { `${ color } 40` }
256+ strokeWidth = { corner ?. strokeWidth }
257+ strokeLinecap = 'round'
258+ strokeLinejoin = 'round'
259+ />
260+ </ svg >
261+ )
0 commit comments