Files
9e05e511-0917-4569-985f-ca3…/src/components/shared/SvgTextLogo/SvgTextLogo.tsx

41 lines
838 B
TypeScript

import React from "react";
interface SvgTextLogoProps {
text: string;
fontSize?: number;
fontWeight?: number;
fill?: string;
className?: string;
}
export const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
fontSize = 24,
fontWeight = 700,
fill = "currentColor", className,
}) => {
const textWidth = text.length * (fontSize * 0.6);
const viewBoxWidth = textWidth + 40;
const viewBoxHeight = fontSize + 20;
return (
<svg
viewBox={`0 0 ${viewBoxWidth} ${viewBoxHeight}`}
className={className}
xmlns="http://www.w3.org/2000/svg"
>
<text
x={20}
y={fontSize + 5}
fontSize={fontSize}
fontWeight={fontWeight}
fill={fill}
dominantBaseline="middle"
>
{text}
</text>
</svg>
);
};
export default SvgTextLogo;