Files
d21f862d-920e-473b-94eb-d2c…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

45 lines
887 B
TypeScript

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