Files
bc27fdb5-b7c7-49a5-9281-e42…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

48 lines
1016 B
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
className?: string;
fontSize?: number;
fontWeight?: number | string;
letterSpacing?: number;
fill?: string;
}
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
className = '',
fontSize = 48,
fontWeight = 700,
letterSpacing = 0,
fill = 'currentColor',
}) => {
const estimatedWidth = text.length * (fontSize as number) * 0.6;
const estimatedHeight = (fontSize as number) * 1.2;
return (
<svg
viewBox={`0 0 ${estimatedWidth} ${estimatedHeight}`}
className={className}
xmlns="http://www.w3.org/2000/svg"
role="img"
aria-label={text}
>
<text
x="50%"
y="50%"
textAnchor="middle"
dominantBaseline="middle"
fontSize={fontSize}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
fill={fill}
fontFamily="inherit"
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;