fix: correctly map exact logo vectors from public/logo-white.svg with correct viewBox
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
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
This commit is contained in:
34
scripts/convert-logo.cjs
Normal file
34
scripts/convert-logo.cjs
Normal file
@@ -0,0 +1,34 @@
|
||||
const fs = require('fs');
|
||||
|
||||
const svgContent = fs.readFileSync('public/logo-white.svg', 'utf8');
|
||||
|
||||
const pathRegex = /<path d="([^"]+)"/g;
|
||||
let paths = [];
|
||||
let match;
|
||||
while ((match = pathRegex.exec(svgContent)) !== null) {
|
||||
paths.push(match[1]);
|
||||
}
|
||||
|
||||
const componentCode = `import React from 'react';
|
||||
import { Svg, G, Path } from '@react-pdf/renderer';
|
||||
|
||||
interface KLZLogoVectorProps {
|
||||
width?: number;
|
||||
color?: string;
|
||||
}
|
||||
|
||||
export const KLZLogoVector: React.FC<KLZLogoVectorProps> = ({ width = 140, color = '#ffffff' }) => {
|
||||
const height = width * (99 / 295);
|
||||
|
||||
return (
|
||||
<Svg viewBox="0 0 295 99" style={{ width, height }}>
|
||||
<G>
|
||||
${paths.map(d => ` <Path d="${d}" fill={color} />`).join('\n')}
|
||||
</G>
|
||||
</Svg>
|
||||
);
|
||||
};
|
||||
`;
|
||||
|
||||
fs.writeFileSync('lib/KLZLogoVector.tsx', componentCode);
|
||||
console.log('Successfully wrote lib/KLZLogoVector.tsx');
|
||||
@@ -13,8 +13,8 @@ import QRCode from 'qrcode';
|
||||
|
||||
const CONFIG = {
|
||||
outputDir: path.join(process.cwd(), 'public/downloads/business-cards'),
|
||||
logoWhite: path.join(process.cwd(), 'public/logo-white.png'),
|
||||
logoBlue: path.join(process.cwd(), 'public/logo-blue.png'),
|
||||
logoWhite: path.join(process.cwd(), 'public/logo-white.svg'),
|
||||
logoBlue: path.join(process.cwd(), 'public/logo-blue.svg'),
|
||||
logoFull: path.join(process.cwd(), 'public/logo-full.png'),
|
||||
truckImage: path.join(process.cwd(), 'public/truck.png'),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user