Files
7ec67df1-5e95-4e26-a78e-fbd…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

48 lines
1.2 KiB
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
fontSize?: number;
fontFamily?: string;
fill?: string;
textAnchor?: 'start' | 'middle' | 'end';
dominantBaseline?: 'auto' | 'inherit' | 'alphabetic' | 'hanging' | 'ideographic' | 'mathematical' | 'text-before-edge' | 'middle' | 'central' | 'text-after-edge' | 'use-script' | 'no-change' | 'reset-size';
className?: string;
}
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
fontSize = 48,
fontFamily = 'Arial, sans-serif',
fill = '#000000',
textAnchor = 'start',
dominantBaseline = 'middle',
className = '',
}) => {
const svgWidth = text.length * (fontSize * 0.6);
const svgHeight = fontSize * 1.5;
return (
<svg
width={svgWidth}
height={svgHeight}
viewBox={`0 0 ${svgWidth} ${svgHeight}`}
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<text
x={svgWidth / 2}
y={svgHeight / 2}
fontSize={fontSize}
fontFamily={fontFamily}
fill={fill}
textAnchor={textAnchor}
dominantBaseline={dominantBaseline}
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;