'use client';
import * as React from 'react';
import {
Text as PDFText,
View as PDFView,
StyleSheet as PDFStyleSheet,
Image as PDFImage
} from '@react-pdf/renderer';
export const pdfStyles = PDFStyleSheet.create({
page: {
paddingTop: 45, // DIN 5008
paddingLeft: 70, // ~25mm
paddingRight: 57, // ~20mm
paddingBottom: 48,
backgroundColor: '#ffffff',
fontFamily: 'Helvetica',
fontSize: 10,
color: '#000000',
},
header: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'flex-start',
marginBottom: 20,
minHeight: 120,
},
addressBlock: {
width: '55%',
marginTop: 45, // DIN 5008 positioning for window
},
senderLine: {
fontSize: 7,
textDecoration: 'underline',
color: '#666666',
marginBottom: 8,
},
recipientAddress: {
fontSize: 10,
lineHeight: 1.4,
},
brandLogoContainer: {
width: '40%',
alignItems: 'flex-end',
},
brandIconContainer: {
width: 40,
height: 40,
backgroundColor: '#000000',
borderRadius: 8,
alignItems: 'center',
justifyContent: 'center',
marginBottom: 12,
},
brandIconText: {
color: '#ffffff',
fontSize: 20,
fontWeight: 'bold',
},
titleInfo: {
marginBottom: 24,
},
mainTitle: {
fontSize: 12,
fontWeight: 'bold',
marginBottom: 4,
color: '#000000',
textTransform: 'uppercase',
letterSpacing: 1,
},
subTitle: {
fontSize: 9,
color: '#666666',
marginTop: 2,
},
section: {
marginBottom: 32,
},
sectionTitle: {
fontSize: 8,
fontWeight: 'bold',
textTransform: 'uppercase',
letterSpacing: 1,
color: '#999999',
marginBottom: 8,
},
footer: {
position: 'absolute',
bottom: 32,
left: 70,
right: 57,
borderTopWidth: 1,
borderTopColor: '#f1f5f9',
paddingTop: 16,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'flex-start',
},
footerColumn: {
flex: 1,
alignItems: 'flex-start',
},
footerLogo: {
height: 20,
width: 'auto',
objectFit: 'contain',
marginBottom: 8,
},
footerText: {
fontSize: 7,
color: '#94a3b8',
lineHeight: 1.5,
},
footerLabel: {
fontWeight: 'bold',
color: '#64748b',
},
pageNumber: {
fontSize: 7,
color: '#cbd5e1',
fontWeight: 'bold',
marginTop: 8,
textAlign: 'right',
},
foldingMark: {
position: 'absolute',
left: 20,
width: 10,
borderTopWidth: 0.5,
borderTopColor: '#cbd5e1',
}
});
export const FoldingMarks = () => (<>>);
export const Footer = ({ logo, companyData, bankData, showDetails = true }: { logo?: string; companyData: any; bankData: any; showDetails?: boolean }) => (
{logo ? () : (marc mintel)}{showDetails && (<>{companyData.name}{"\n"}{companyData.address1}{"\n"}{companyData.address2}{"\n"}UST: {companyData.ustId}{bankData.name}{"\n"}{bankData.bic}{"\n"}{bankData.iban} `${pageNumber} / ${totalPages}`} fixed />>)}{!showDetails && ( `${pageNumber} / ${totalPages}`} fixed />)}
);
export const Header = ({ sender, recipient, icon, showAddress = true }: { sender?: string; recipient?: { title: string; subtitle?: string; email?: string; address?: string; phone?: string; taxId?: string }; icon?: string; showAddress?: boolean; }) => (
{showAddress && sender && (<>{sender}{recipient && ({recipient.title}{recipient.subtitle && {recipient.subtitle}}{recipient.address && {recipient.address}}{recipient.phone && {recipient.phone}}{recipient.email && {recipient.email}}{recipient.taxId && USt-ID: {recipient.taxId}})}>)}{icon ? () : (M)}
);
export const DocumentTitle = ({ title, subLines }: { title: string; subLines?: string[] }) => (
{title}{subLines?.map((line, i) => ({line}))}
);