Files
87e3427b-5020-4e26-aee6-028…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

49 lines
999 B
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
className?: string;
fontSize?: number;
fontWeight?: number | string;
letterSpacing?: number;
fillColor?: string;
}
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
className = '',
fontSize = 48,
fontWeight = 700,
letterSpacing = 0,
fillColor = 'currentColor',
}) => {
const textLength = text.length;
const charWidth = fontSize * 0.6;
const width = textLength * charWidth + letterSpacing * (textLength - 1);
const height = fontSize * 1.2;
return (
<svg
viewBox={`0 0 ${width} ${height}`}
width={width}
height={height}
className={className}
aria-label={text}
>
<text
x="0"
y={fontSize}
fontSize={fontSize}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
fill={fillColor}
dominantBaseline="auto"
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;