fix(pdf): implement full logo, remove fixed header, add break logic
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
/* eslint-disable react/prop-types */
|
|
||||||
import { Document, Page, View, Text, StyleSheet, Link, Image } from '@react-pdf/renderer';
|
import { Document, Page, View, Text, StyleSheet, Link, Image } from '@react-pdf/renderer';
|
||||||
|
|
||||||
// Standard fonts like Helvetica are built-in to PDF and don't require registration
|
// Standard fonts like Helvetica are built-in to PDF and don't require registration
|
||||||
@@ -52,8 +52,8 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
logo: {
|
logo: {
|
||||||
width: 60,
|
width: 140, // Increased to fit full logo
|
||||||
height: 30,
|
height: 45,
|
||||||
objectFit: 'contain',
|
objectFit: 'contain',
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ const renderLexicalNode = (node: any, idx: number): React.ReactNode => {
|
|||||||
case 'paragraph': {
|
case 'paragraph': {
|
||||||
if (!node.children || node.children.length === 0) return null;
|
if (!node.children || node.children.length === 0) return null;
|
||||||
return (
|
return (
|
||||||
<Text key={idx} style={styles.paragraph}>
|
<Text key={idx} style={styles.paragraph} minPresenceAhead={15}>
|
||||||
{node.children?.map((child: any, i: number) => renderLexicalNode(child, i))}
|
{node.children?.map((child: any, i: number) => renderLexicalNode(child, i))}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
@@ -260,14 +260,14 @@ const renderLexicalNode = (node: any, idx: number): React.ReactNode => {
|
|||||||
if (node.tag === 'h2') hStyle = styles.heading2;
|
if (node.tag === 'h2') hStyle = styles.heading2;
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<Text key={idx} style={hStyle}>
|
<Text key={idx} style={hStyle} wrap={false} minPresenceAhead={100}>
|
||||||
{node.children?.map((child: any, i: number) => renderLexicalNode(child, i))}
|
{node.children?.map((child: any, i: number) => renderLexicalNode(child, i))}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isH1) {
|
if (isH1) {
|
||||||
return (
|
return (
|
||||||
<View key={idx} style={styles.heading1Wrapper}>
|
<View key={idx} style={styles.heading1Wrapper} wrap={false} minPresenceAhead={100}>
|
||||||
{content}
|
{content}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -283,7 +283,7 @@ const renderLexicalNode = (node: any, idx: number): React.ReactNode => {
|
|||||||
{node.children?.map((child: any, i: number) => {
|
{node.children?.map((child: any, i: number) => {
|
||||||
if (child.type === 'listitem') {
|
if (child.type === 'listitem') {
|
||||||
return (
|
return (
|
||||||
<View key={i} style={styles.listItem}>
|
<View key={i} style={styles.listItem} wrap={false}>
|
||||||
<Text style={styles.listItemBullet}>
|
<Text style={styles.listItemBullet}>
|
||||||
{node.listType === 'number' ? `${i + 1}.` : '•'}
|
{node.listType === 'number' ? `${i + 1}.` : '•'}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -340,18 +340,15 @@ export const PDFPage: React.FC<PDFPageProps> = ({ page, locale = 'de' }) => {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
});
|
});
|
||||||
|
|
||||||
const logoPath = `${process.cwd()}/public/logo.png`;
|
const logoPath = `${process.cwd()}/public/logo-full.png`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Document>
|
<Document>
|
||||||
<Page size="A4" style={styles.page}>
|
<Page size="A4" style={styles.page}>
|
||||||
{/* Improved Hero Header */}
|
{/* Improved Hero Header - No longer fixed so it doesn't repeat on all pages */}
|
||||||
<View style={styles.hero} fixed>
|
<View style={styles.hero}>
|
||||||
<View style={styles.headerTop}>
|
<View style={styles.headerTop}>
|
||||||
<Image src={logoPath} style={styles.logo} />
|
<Image src={logoPath} style={styles.logo} />
|
||||||
<Text style={styles.docType}>
|
|
||||||
{locale === 'en' ? 'Official Document' : 'Offizielles Dokument'}
|
|
||||||
</Text>
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={styles.headerTitleArea}>
|
<View style={styles.headerTitleArea}>
|
||||||
|
|||||||
BIN
public/logo-full.png
Normal file
BIN
public/logo-full.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
Reference in New Issue
Block a user