46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import React, { SVGAttributes } from 'react';
|
|
|
|
interface SvgTextLogoProps {
|
|
text: string;
|
|
className?: string;
|
|
fontSize?: number;
|
|
fontWeight?: number | string;
|
|
letterSpacing?: number;
|
|
fill?: string;
|
|
textAnchor?: 'start' | 'middle' | 'end';
|
|
dominantBaseline?: SVGAttributes<SVGTextElement>['dominantBaseline'];
|
|
}
|
|
|
|
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
|
|
text,
|
|
className = '',
|
|
fontSize = 48,
|
|
fontWeight = 700,
|
|
letterSpacing = 0,
|
|
fill = 'currentColor',
|
|
textAnchor = 'middle',
|
|
dominantBaseline = 'middle',
|
|
}) => {
|
|
return (
|
|
<svg
|
|
viewBox={`0 0 ${text.length * fontSize * 0.6} ${fontSize * 1.5}`}
|
|
className={className}
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<text
|
|
x={`${text.length * fontSize * 0.3}`}
|
|
y={`${fontSize * 0.75}`}
|
|
fontSize={fontSize}
|
|
fontWeight={fontWeight}
|
|
letterSpacing={letterSpacing}
|
|
fill={fill}
|
|
textAnchor={textAnchor}
|
|
dominantBaseline={dominantBaseline as any}
|
|
>
|
|
{text}
|
|
</text>
|
|
</svg>
|
|
);
|
|
};
|
|
|
|
export default SvgTextLogo; |