import React from 'react';

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

const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
  text,
  className = '',
  fontSize = 32,
  fontWeight = 700,
  fill = 'currentColor',
  letterSpacing = 0,
}) => {
  const textWidth = text.length * (fontSize as number) * 0.6;
  const viewBoxWidth = textWidth + 40;
  const viewBoxHeight = (fontSize as number) * 1.5;

  return (
    <svg
      viewBox={`0 0 ${viewBoxWidth} ${viewBoxHeight}`}
      width="100%"
      height="100%"
      preserveAspectRatio="xMidYMid meet"
      className={className}
      xmlns="http://www.w3.org/2000/svg"
    >
      <text
        x="50%"
        y="50%"
        textAnchor="middle"
        dominantBaseline="central"
        fontSize={fontSize}
        fontWeight={fontWeight}
        fill={fill}
        letterSpacing={letterSpacing}
        fontFamily="inherit"
      >
        {text}
      </text>
    </svg>
  );
};

export default SvgTextLogo;
