Files
1c7ace42-eaac-4f31-8c80-b42…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

52 lines
1.1 KiB
TypeScript

import React from 'react';
interface SvgTextLogoProps {
text: string;
className?: string;
fontSize?: number;
fontWeight?: number | string;
letterSpacing?: number;
dominantBaseline?: 'auto' | 'middle' | 'hanging' | 'text-top' | 'text-bottom' | 'central' | 'mathematical' | 'ideographic';
}
const SvgTextLogo = React.forwardRef<SVGSVGElement, SvgTextLogoProps>(
(
{
text,
className = '',
fontSize = 48,
fontWeight = 700,
letterSpacing = 0,
dominantBaseline = 'middle',
},
ref
) => {
return (
<svg
ref={ref}
viewBox={`0 0 ${text.length * fontSize * 0.6} ${fontSize * 1.2}`}
className={className}
xmlns="http://www.w3.org/2000/svg"
>
<text
x="50%"
y="50%"
textAnchor="middle"
dominantBaseline="middle"
fontSize={fontSize}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
fill="currentColor"
className="font-sans"
>
{text}
</text>
</svg>
);
}
);
SvgTextLogo.displayName = 'SvgTextLogo';
export default SvgTextLogo;