@@ -52,7 +52,6 @@ const createStyles = (brandColor) =>
5252 alignSelf : 'flex-start' ,
5353 } ,
5454 mainTitle : {
55- fontSize : 48 ,
5655 fontWeight : 'bold' ,
5756 color : '#1A202C' ,
5857 lineHeight : 1.1 ,
@@ -130,6 +129,8 @@ const createStyles = (brandColor) =>
130129 fontWeight : 'bold' ,
131130 color : '#1A202C' ,
132131 marginBottom : 8 ,
132+ paddingTop : 4 ,
133+ paddingBottom : 4 ,
133134 } ,
134135 pageSubtitle : { fontSize : 11 , color : '#4A5568' , fontWeight : 'normal' } ,
135136 headerLogo : { height : 30 } ,
@@ -143,6 +144,8 @@ const createStyles = (brandColor) =>
143144 fontWeight : 'bold' ,
144145 color : brandColor ,
145146 marginBottom : 12 ,
147+ paddingTop : 4 ,
148+ paddingBottom : 4 ,
146149 pageBreakAfter : 'avoid' ,
147150 breakAfter : 'avoid' ,
148151 orphans : 3 ,
@@ -261,20 +264,26 @@ const createStyles = (brandColor) =>
261264 color : '#1A202C' ,
262265 marginTop : 10 ,
263266 marginBottom : 6 ,
267+ paddingTop : 4 ,
268+ paddingBottom : 2 ,
264269 } ,
265270 heading2 : {
266271 fontSize : 14 ,
267272 fontWeight : 'bold' ,
268273 color : brandColor ,
269274 marginTop : 8 ,
270275 marginBottom : 5 ,
276+ paddingTop : 4 ,
277+ paddingBottom : 2 ,
271278 } ,
272279 heading3 : {
273280 fontSize : 12 ,
274281 fontWeight : 'bold' ,
275282 color : '#2D3748' ,
276283 marginTop : 6 ,
277284 marginBottom : 4 ,
285+ paddingTop : 3 ,
286+ paddingBottom : 2 ,
278287 } ,
279288
280289 /* ── Code ──────────────────────────────────────────── */
@@ -616,6 +625,10 @@ export const ReportBuilderDocument = ({
616625 const reportName = templateName || 'Report'
617626 const safeBlocks = blocks || [ ]
618627
628+ // Dynamic cover title: shrink font for long names, truncate beyond 50 chars
629+ const coverTitle = reportName . length > 50 ? reportName . slice ( 0 , 47 ) + '...' : reportName
630+ const coverTitleFontSize = coverTitle . length <= 20 ? 48 : coverTitle . length <= 35 ? 36 : 28
631+
619632 return (
620633 < Document >
621634 { /* ── Cover Page ── */ }
@@ -631,13 +644,13 @@ export const ReportBuilderDocument = ({
631644
632645 < View style = { s . coverHero } >
633646 < Text style = { s . coverLabel } > ASSESSMENT REPORT</ Text >
634- < Text style = { s . mainTitle } >
635- { reportName . toUpperCase ( ) . split ( ' ' ) . slice ( 0 , - 1 ) . join ( ' ' ) || reportName . toUpperCase ( ) }
636- { reportName . split ( ' ' ) . length > 1 ? (
647+ < Text style = { { ... s . mainTitle , fontSize : coverTitleFontSize } } >
648+ { coverTitle . toUpperCase ( ) . split ( ' ' ) . slice ( 0 , - 1 ) . join ( ' ' ) || coverTitle . toUpperCase ( ) }
649+ { coverTitle . split ( ' ' ) . length > 1 ? (
637650 < >
638651 { '\n' }
639652 < Text style = { s . titleAccent } >
640- { reportName . toUpperCase ( ) . split ( ' ' ) . slice ( - 1 ) [ 0 ] }
653+ { coverTitle . toUpperCase ( ) . split ( ' ' ) . slice ( - 1 ) [ 0 ] }
641654 </ Text >
642655 </ >
643656 ) : null }
0 commit comments