52 lines
1.0 KiB
TypeScript
52 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
|
|
interface SvgTextLogoProps {
|
|
text: string;
|
|
className?: string;
|
|
fontSize?: number;
|
|
fontWeight?: 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold';
|
|
fill?: string;
|
|
}
|
|
|
|
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
|
|
text,
|
|
className = '',
|
|
fontSize = 48,
|
|
fontWeight = 'bold',
|
|
fill = 'currentColor',
|
|
}) => {
|
|
const fontWeightMap: Record<string, number> = {
|
|
light: 300,
|
|
normal: 400,
|
|
medium: 500,
|
|
semibold: 600,
|
|
bold: 700,
|
|
extrabold: 800,
|
|
};
|
|
|
|
const fontWeightValue = fontWeightMap[fontWeight] || 400;
|
|
|
|
return (
|
|
<svg
|
|
viewBox={`0 0 ${text.length * fontSize * 0.6} ${fontSize * 1.5}`}
|
|
className={className}
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<text
|
|
x="50%"
|
|
y="50%"
|
|
textAnchor="middle"
|
|
dominantBaseline="central"
|
|
fontSize={fontSize}
|
|
fontWeight={fontWeightValue}
|
|
fill={fill}
|
|
fontFamily="inherit"
|
|
>
|
|
{text}
|
|
</text>
|
|
</svg>
|
|
);
|
|
};
|
|
|
|
export default SvgTextLogo;
|