Files
a02fee81-a7a7-41e5-bf36-47f…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

47 lines
1.1 KiB
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
fontSize?: number;
fontFamily?: string;
fontWeight?: string | number;
className?: string;
textClassName?: string;
}
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
fontSize = 48,
fontFamily = 'system-ui, -apple-system, sans-serif',
fontWeight = 'bold',
className = '',
textClassName = '',
}) => {
const padding = 20;
const estimatedWidth = text.length * (fontSize * 0.6) + padding * 2;
const estimatedHeight = fontSize + padding * 2;
return (
<svg
width={estimatedWidth}
height={estimatedHeight}
viewBox={`0 0 ${estimatedWidth} ${estimatedHeight}`}
className={className}
xmlns="http://www.w3.org/2000/svg"
>
<text
x={padding}
y={fontSize + padding}
fontSize={fontSize}
fontFamily={fontFamily}
fontWeight={fontWeight}
dominantBaseline="text-after-edge"
className={textClassName}
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;