Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
- Previously, the logo was cropped because of an incorrect viewBox (100x100 instead of 295x99) - Mapped all vector paths perfectly to ensure exact branding parity
181 lines
4.4 KiB
TypeScript
181 lines
4.4 KiB
TypeScript
import React from 'react';
|
|
import { Document, Page, Text, View, StyleSheet, Image } from '@react-pdf/renderer';
|
|
|
|
import { KLZLogoVector } from './KLZLogoVector';
|
|
|
|
export interface PersonData {
|
|
name: string;
|
|
role: string;
|
|
phone: string;
|
|
email: string;
|
|
}
|
|
|
|
interface PDFBusinessCardProps {
|
|
person: PersonData;
|
|
qrCodeDataUrl: string;
|
|
}
|
|
|
|
// Mintel Aesthetics Colors - EXACT PROD COLORS
|
|
const COLORS = {
|
|
primary: '#011dff', // Bright Royal Blue
|
|
green: '#82ed20', // Brand Accent Green
|
|
white: '#ffffff',
|
|
grayText: '#6c757d',
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
pageBleed: {
|
|
// 85x55mm + 3mm bleed on each side = 91x61mm
|
|
width: '91mm',
|
|
height: '61mm',
|
|
backgroundColor: COLORS.primary,
|
|
position: 'relative',
|
|
fontFamily: 'Helvetica',
|
|
overflow: 'hidden',
|
|
},
|
|
pageBleedBack: {
|
|
width: '91mm',
|
|
height: '61mm',
|
|
backgroundColor: COLORS.white,
|
|
position: 'relative',
|
|
fontFamily: 'Helvetica',
|
|
overflow: 'hidden',
|
|
},
|
|
|
|
// -- FRONT --
|
|
frontContainer: {
|
|
flex: 1,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
},
|
|
|
|
// -- BACK --
|
|
backContainer: {
|
|
flex: 1,
|
|
padding: '8mm',
|
|
flexDirection: 'column',
|
|
justifyContent: 'space-between',
|
|
},
|
|
backHeader: {
|
|
marginBottom: 'auto',
|
|
},
|
|
backBody: {
|
|
flexDirection: 'row',
|
|
justifyContent: 'space-between',
|
|
alignItems: 'flex-end',
|
|
width: '100%',
|
|
},
|
|
leftColumn: {
|
|
flex: 1,
|
|
flexDirection: 'column',
|
|
paddingRight: '4mm',
|
|
},
|
|
nameSection: {
|
|
marginBottom: '6mm',
|
|
},
|
|
nameText: {
|
|
fontSize: 14,
|
|
fontWeight: 'bold',
|
|
color: COLORS.primary,
|
|
marginBottom: 2,
|
|
},
|
|
roleText: {
|
|
fontSize: 7.5,
|
|
fontWeight: 'normal',
|
|
color: COLORS.grayText,
|
|
letterSpacing: 0.5,
|
|
textTransform: 'uppercase',
|
|
},
|
|
contactSection: {
|
|
flexDirection: 'column',
|
|
},
|
|
contactRow: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
marginBottom: 4,
|
|
},
|
|
iconCircle: {
|
|
width: 4,
|
|
height: 4,
|
|
borderRadius: 2,
|
|
backgroundColor: COLORS.green,
|
|
marginRight: 6,
|
|
},
|
|
contactText: {
|
|
fontSize: 7,
|
|
color: COLORS.primary,
|
|
fontWeight: 'normal',
|
|
},
|
|
rightColumn: {
|
|
width: '18mm',
|
|
flexDirection: 'column',
|
|
alignItems: 'flex-end',
|
|
},
|
|
qrCodeWrapper: {
|
|
width: '18mm',
|
|
height: '18mm',
|
|
padding: 1,
|
|
backgroundColor: COLORS.white,
|
|
},
|
|
qrCode: {
|
|
width: '100%',
|
|
height: '100%',
|
|
},
|
|
});
|
|
|
|
export const PDFBusinessCard: React.FC<PDFBusinessCardProps> = ({ person, qrCodeDataUrl }) => {
|
|
return (
|
|
<Document
|
|
title={`Business Card - ${person.name}`}
|
|
author="KLZ Cables"
|
|
creator="KLZ Print Engine"
|
|
>
|
|
{/* FRONT - Clean Modern KLZ Brand */}
|
|
<Page size={[258, 173]} style={styles.pageBleed}>
|
|
<View style={styles.frontContainer}>
|
|
<KLZLogoVector width={140} color={COLORS.white} />
|
|
</View>
|
|
</Page>
|
|
|
|
{/* BACK - Clean White with Bright Blue & Green Accents */}
|
|
<Page size={[258, 173]} style={styles.pageBleedBack}>
|
|
<View style={styles.backContainer}>
|
|
<View style={styles.backHeader}>
|
|
<KLZLogoVector width={80} color={COLORS.primary} />
|
|
</View>
|
|
|
|
<View style={styles.backBody}>
|
|
<View style={styles.leftColumn}>
|
|
<View style={styles.nameSection}>
|
|
<Text style={styles.nameText}>{person.name}</Text>
|
|
<Text style={styles.roleText}>{person.role}</Text>
|
|
</View>
|
|
|
|
<View style={styles.contactSection}>
|
|
<View style={styles.contactRow}>
|
|
<View style={styles.iconCircle} />
|
|
<Text style={styles.contactText}>{person.phone}</Text>
|
|
</View>
|
|
<View style={styles.contactRow}>
|
|
<View style={styles.iconCircle} />
|
|
<Text style={styles.contactText}>{person.email}</Text>
|
|
</View>
|
|
<View style={styles.contactRow}>
|
|
<View style={styles.iconCircle} />
|
|
<Text style={styles.contactText}>klz-cables.com</Text>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
|
|
<View style={styles.rightColumn}>
|
|
<View style={styles.qrCodeWrapper}>
|
|
<Image src={qrCodeDataUrl} style={styles.qrCode} />
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</Page>
|
|
</Document>
|
|
);
|
|
};
|