Files
e6dfb4af-e829-4699-b0e1-233…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

45 lines
877 B
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
className?: string;
fontSize?: number;
fontWeight?: string;
fill?: string;
}
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
className = '',
fontSize = 24,
fontWeight = '700',
fill = 'currentColor',
}) => {
const textLength = text.length;
const charWidth = fontSize * 0.6;
const width = charWidth * textLength + 20;
const height = fontSize + 20;
return (
<svg
viewBox={`0 0 ${width} ${height}`}
className={className}
xmlns="http://www.w3.org/2000/svg"
>
<text
x={width / 2}
y={height / 2}
fontSize={fontSize}
fontWeight={fontWeight}
fill={fill}
textAnchor="middle"
dominantBaseline="central"
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;