45 lines
1020 B
TypeScript
45 lines
1020 B
TypeScript
import React from 'react';
|
|
|
|
interface SvgTextLogoProps {
|
|
text: string;
|
|
className?: string;
|
|
textClassName?: string;
|
|
tspanClassName?: string;
|
|
}
|
|
|
|
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
|
|
text,
|
|
className = '',
|
|
textClassName = '',
|
|
tspanClassName = '',
|
|
}) => {
|
|
return (
|
|
<svg
|
|
viewBox={`0 0 ${text.length * 60} 100`}
|
|
className={`w-full h-auto ${className}`}
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
preserveAspectRatio="xMidYMid meet"
|
|
>
|
|
<text
|
|
x="50%"
|
|
y="50%"
|
|
textAnchor="middle"
|
|
dominantBaseline="central"
|
|
className={`text-4xl font-bold fill-current ${textClassName}`}
|
|
>
|
|
{text.split('').map((char, index) => (
|
|
<tspan
|
|
key={index}
|
|
x={`${(index + 0.5) * (100 / text.length)}%`}
|
|
dy={index === 0 ? 0 : '1.2em'}
|
|
className={tspanClassName}
|
|
>
|
|
{char}
|
|
</tspan>
|
|
))}
|
|
</text>
|
|
</svg>
|
|
);
|
|
};
|
|
|
|
export default SvgTextLogo; |