Files
031848da-cd04-4b3f-82aa-2c3…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

48 lines
1.0 KiB
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
className?: string;
fontSize?: number;
fontWeight?: number | string;
letterSpacing?: number;
}
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
className = '',
fontSize = 48,
fontWeight = 700,
letterSpacing = 0,
}) => {
const charWidth = fontSize * 0.6;
const totalWidth = text.length * charWidth + letterSpacing * (text.length - 1);
const height = fontSize * 1.2;
const x = fontSize * 0.1;
const y = fontSize * 0.85;
return (
<svg
viewBox={`0 0 ${totalWidth + fontSize * 0.2} ${height}`}
className={className}
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid meet"
>
<text
x={x}
y={y}
fontSize={fontSize}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
fill="currentColor"
textAnchor="start"
dominantBaseline="auto"
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;