Files
2a09d4e6-b23c-4336-aaf2-122…/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?: string | number;
fill?: string;
fontFamily?: string;
}
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
className = '',
fontSize = 48,
fontWeight = 700,
fill = 'currentColor',
fontFamily = 'system-ui, -apple-system, sans-serif',
}) => {
const textLength = text.length;
const estimatedWidth = textLength * (fontSize * 0.6);
const estimatedHeight = fontSize * 1.5;
return (
<svg
viewBox={`0 0 ${estimatedWidth} ${estimatedHeight}`}
className={className}
width={estimatedWidth}
height={estimatedHeight}
xmlns="http://www.w3.org/2000/svg"
>
<text
x="50%"
y="50%"
fontSize={fontSize}
fontWeight={fontWeight}
fill={fill}
fontFamily={fontFamily}
textAnchor="middle"
dominantBaseline="central"
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;