Files
eb0fca55-71a1-418c-947f-b1c…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

48 lines
976 B
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 = 2,
}) => {
const svgWidth = text.length * (fontSize * 0.6);
const svgHeight = fontSize * 1.5;
return (
<svg
width={svgWidth}
height={svgHeight}
viewBox={`0 0 ${svgWidth} ${svgHeight}`}
xmlns="http://www.w3.org/2000/svg"
className={className}
role="img"
aria-label={text}
>
<text
x={svgWidth / 2}
y={svgHeight / 2}
fontSize={fontSize}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
textAnchor="middle"
dominantBaseline="central"
fill="currentColor"
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;