Files
4b5c850f-c291-4782-8a98-086…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

49 lines
1.0 KiB
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
className?: string;
fontSize?: number;
fontWeight?: number | string;
letterSpacing?: number;
}
export const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
className = '',
fontSize = 48,
fontWeight = 700,
letterSpacing = 0,
}) => {
const textLength = text.length;
const charWidth = fontSize * 0.6;
const totalWidth = textLength * charWidth + (textLength - 1) * letterSpacing;
const height = fontSize * 1.2;
return (
<svg
width="100%"
height="100%"
viewBox={`0 0 ${totalWidth} ${height}`}
preserveAspectRatio="xMidYMid meet"
className={className}
aria-label={text}
>
<text
x="50%"
y="50%"
textAnchor="middle"
dominantBaseline="middle"
fontSize={fontSize}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
fill="currentColor"
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;