57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
|
|
interface SvgTextLogoProps {
|
|
text: string;
|
|
className?: string;
|
|
pathClassName?: string;
|
|
textClassName?: string;
|
|
textXClassName?: string;
|
|
dominantBaseline?: 'auto' | 'baseline' | 'before-edge' | 'after-edge' | 'central' | 'hanging' | 'math' | 'ideographic';
|
|
}
|
|
|
|
export const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
|
|
text,
|
|
className = '',
|
|
pathClassName = '',
|
|
textClassName = '',
|
|
textXClassName = '',
|
|
dominantBaseline = 'central',
|
|
}) => {
|
|
const pathId = `textPath-${Math.random().toString(36).substr(2, 9)}`;
|
|
|
|
return (
|
|
<svg
|
|
viewBox="0 0 1000 200"
|
|
className={`w-full h-auto ${className}`}
|
|
preserveAspectRatio="xMidYMid meet"
|
|
>
|
|
<defs>
|
|
<path
|
|
id={pathId}
|
|
d="M 50,100 Q 250,50 500,100 T 950,100"
|
|
fill="none"
|
|
className={pathClassName}
|
|
/>
|
|
</defs>
|
|
<text
|
|
className={textClassName}
|
|
fontSize="48"
|
|
fontWeight="bold"
|
|
fill="currentColor"
|
|
dominantBaseline={dominantBaseline}
|
|
textAnchor="middle"
|
|
>
|
|
<textPath
|
|
href={`#${pathId}`}
|
|
startOffset="50%"
|
|
className={textXClassName}
|
|
>
|
|
{text}
|
|
</textPath>
|
|
</text>
|
|
</svg>
|
|
);
|
|
};
|
|
|
|
export default SvgTextLogo;
|