Files
7be5f765-54f6-40c7-981f-e45…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

47 lines
973 B
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
className?: string;
textClassName?: string;
fontSize?: number;
fontWeight?: number | string;
letterSpacing?: number;
}
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
className = '',
textClassName = '',
fontSize = 48,
fontWeight = 700,
letterSpacing = 0,
}) => {
const svgWidth = text.length * (fontSize * 0.6) + 40;
const svgHeight = fontSize + 20;
return (
<svg
width={svgWidth}
height={svgHeight}
viewBox={`0 0 ${svgWidth} ${svgHeight}`}
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<text
x="50%"
y="50%"
textAnchor="middle"
dominantBaseline="central"
fontSize={fontSize}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
className={textClassName}
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;