import React from "react";

interface SvgTextLogoProps {
  text: string;
  className?: string;
  fontSize?: number;
  fontFamily?: string;
  fontWeight?: string | number;
  fill?: string;
  letterSpacing?: number;
}

const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
  text,
  className = "",  fontSize = 48,
  fontFamily = "Inter, sans-serif",  fontWeight = 600,
  fill = "currentColor",  letterSpacing = 0,
}) => {
  const textLength = text.length;
  const charWidth = fontSize * 0.5;
  const width = textLength * charWidth + 20;
  const height = fontSize + 20;

  return (
    <svg
      width={width}
      height={height}
      viewBox={`0 0 ${width} ${height}`}
      className={className}
      xmlns="http://www.w3.org/2000/svg"
    >
      <text
        x={width / 2}
        y={height / 2}
        textAnchor="middle"
        dominantBaseline="central"
        fontSize={fontSize}
        fontFamily={fontFamily}
        fontWeight={fontWeight}
        fill={fill}
        letterSpacing={letterSpacing}
      >
        {text}
      </text>
    </svg>
  );
};

export default SvgTextLogo;