File tree Expand file tree Collapse file tree 2 files changed +35
-17
lines changed
Expand file tree Collapse file tree 2 files changed +35
-17
lines changed Original file line number Diff line number Diff line change @@ -31,19 +31,21 @@ export async function generateOgPng(
3131 const assets = loadOgAssets ( )
3232 const accentColor = getAccentColor ( library . id )
3333 const libraryName = library . name
34+ const pitch = clampText ( library . tagline ?? '' , MAX_DESCRIPTION_LENGTH )
3435 const docTitle = input . title ?. trim ( )
3536 ? clampText ( input . title . trim ( ) , MAX_TITLE_LENGTH )
3637 : undefined
37- const rawDescription =
38- input . description ? .trim ( ) || library . tagline || library . description || ''
39- const description = clampText ( rawDescription , MAX_DESCRIPTION_LENGTH )
38+ const description = input . description ?. trim ( )
39+ ? clampText ( input . description . trim ( ) , MAX_DESCRIPTION_LENGTH )
40+ : undefined
4041
4142 const tree = buildOgTree ( {
4243 libraryName,
4344 accentColor,
4445 islandDataUrl : assets . islandDataUrl ,
45- description ,
46+ pitch ,
4647 docTitle,
48+ description,
4749 } )
4850
4951 const svg = await satori ( tree , {
Original file line number Diff line number Diff line change @@ -4,8 +4,9 @@ type TemplateProps = {
44 libraryName : string
55 accentColor : string
66 islandDataUrl : string
7- description : string
7+ pitch : string
88 docTitle ?: string
9+ description ?: string
910}
1011
1112const WIDTH = 1200
@@ -72,7 +73,7 @@ export function buildOgTree(props: TemplateProps): ReactElement {
7273 style = { {
7374 display : 'flex' ,
7475 flexDirection : 'column' ,
75- marginBottom : 24 ,
76+ marginBottom : 22 ,
7677 lineHeight : 0.95 ,
7778 fontWeight : 800 ,
7879 letterSpacing : '-0.02em' ,
@@ -85,30 +86,45 @@ export function buildOgTree(props: TemplateProps): ReactElement {
8586 </ span >
8687 ) : null }
8788 </ div >
89+ { props . pitch ? (
90+ < div
91+ style = { {
92+ fontSize : 28 ,
93+ fontWeight : 500 ,
94+ lineHeight : 1.3 ,
95+ color : props . accentColor ,
96+ marginBottom : props . docTitle || props . description ? 22 : 0 ,
97+ } }
98+ >
99+ { props . pitch }
100+ </ div >
101+ ) : null }
88102 { props . docTitle ? (
89103 < div
90104 style = { {
91105 fontSize : 44 ,
92106 fontWeight : 800 ,
93107 lineHeight : 1.05 ,
94108 letterSpacing : '-0.015em' ,
95- marginBottom : 16 ,
109+ marginBottom : 14 ,
96110 color : props . accentColor ,
97111 } }
98112 >
99113 { props . docTitle }
100114 </ div >
101115 ) : null }
102- < div
103- style = { {
104- fontSize : 26 ,
105- lineHeight : 1.3 ,
106- fontWeight : 700 ,
107- color : props . accentColor ,
108- } }
109- >
110- { props . description }
111- </ div >
116+ { props . description ? (
117+ < div
118+ style = { {
119+ fontSize : 22 ,
120+ lineHeight : 1.3 ,
121+ fontWeight : 500 ,
122+ color : props . accentColor ,
123+ } }
124+ >
125+ { props . description }
126+ </ div >
127+ ) : null }
112128 </ div >
113129 </ div >
114130 )
You can’t perform that action at this time.
0 commit comments