import React from 'react';

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

const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
  text,
  className = '',
  fontSize = 48,
  fontWeight = 700,
  letterSpacing = 0,
  fill = 'currentColor',
  strokeWidth = 0,
  stroke = 'none',
}) => {
  const textLength = text.length;
  const estimatedWidth = textLength * (fontSize * 0.6);
  const padding = 20;
  const width = estimatedWidth + padding * 2;
  const height = fontSize * 1.5;

  return (
    <svg
      viewBox={`0 0 ${width} ${height}`}
      width={width}
      height={height}
      xmlns="http://www.w3.org/2000/svg"
      className={className}
      aria-label={text}
    >
      <text
        x={padding}
        y={fontSize}
        fontSize={fontSize}
        fontWeight={fontWeight}
        letterSpacing={letterSpacing}
        fill={fill}
        strokeWidth={strokeWidth}
        stroke={stroke}
        dominantBaseline="auto"
      >
        {text}
      </text>
    </svg>
  );
};

export default SvgTextLogo;
