import React from 'react';

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

const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
  text,
  className = '',
  fontSize = 48,
  fontWeight = 700,
  letterSpacing = 0,
  fill = 'currentColor',
}) => {
  const textLength = text.length;
  const charWidth = fontSize * 0.6;
  const width = textLength * charWidth + 40;
  const height = fontSize + 40;

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

export default SvgTextLogo;
