Files
e01beedb-6f2a-40be-99ab-371…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

50 lines
1.1 KiB
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
fontSize?: number;
fontFamily?: string;
fontWeight?: number | string;
letterSpacing?: number;
className?: string;
}
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
fontSize = 48,
fontFamily = 'Arial, sans-serif',
fontWeight = 'bold',
letterSpacing = 0,
className = '',
}) => {
const padding = 20;
const estimatedWidth = text.length * (fontSize * 0.6) + padding * 2;
const height = fontSize + padding * 2;
return (
<svg
viewBox={`0 0 ${estimatedWidth} ${height}`}
width={estimatedWidth}
height={height}
xmlns="http://www.w3.org/2000/svg"
className={className}
preserveAspectRatio="xMidYMid meet"
>
<text
x={padding}
y={fontSize + padding / 2}
fontSize={fontSize}
fontFamily={fontFamily}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
dominantBaseline="middle"
fill="currentColor"
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;