51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
|
|
interface SvgTextLogoProps {
|
|
text: string;
|
|
className?: string;
|
|
fontSize?: number;
|
|
fontWeight?: number | string;
|
|
letterSpacing?: number;
|
|
lineHeight?: number;
|
|
}
|
|
|
|
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
|
|
text,
|
|
className = '',
|
|
fontSize = 48,
|
|
fontWeight = 700,
|
|
letterSpacing = -2,
|
|
lineHeight = 1.2,
|
|
}) => {
|
|
const lines = text.split('\n');
|
|
const lineHeightPx = typeof fontSize === 'number' ? fontSize * lineHeight : 60;
|
|
const totalHeight = lineHeightPx * lines.length;
|
|
|
|
return (
|
|
<svg
|
|
width="auto"
|
|
height={totalHeight}
|
|
viewBox={`0 0 400 ${totalHeight}`}
|
|
className={className}
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
{lines.map((line, index) => (
|
|
<text
|
|
key={index}
|
|
x="0"
|
|
y={lineHeightPx * (index + 1)}
|
|
fontSize={fontSize}
|
|
fontWeight={fontWeight}
|
|
letterSpacing={letterSpacing}
|
|
dominantBaseline="hanging"
|
|
className="fill-current"
|
|
>
|
|
{line}
|
|
</text>
|
|
))}
|
|
</svg>
|
|
);
|
|
};
|
|
|
|
export default SvgTextLogo;
|