Files
0af7878e-4772-4b99-b2db-d14…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

50 lines
1.1 KiB
TypeScript

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