import React from 'react';

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

const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
  text,
  className = '',
  fontSize = 48,
  fontWeight = 'bold',
  letterSpacing = 0,
}) => {
  const textLength = text.length;
  const charWidth = fontSize * 0.6;
  const svgWidth = textLength * charWidth + letterSpacing * (textLength - 1);
  const svgHeight = fontSize * 1.4;

  return (
    <svg
      width={svgWidth}
      height={svgHeight}
      viewBox={`0 0 ${svgWidth} ${svgHeight}`}
      className={className}
      xmlns="http://www.w3.org/2000/svg"
      aria-label={text}
    >
      <text
        x={charWidth / 2}
        y={fontSize}
        fontSize={fontSize}
        fontWeight={fontWeight}
        letterSpacing={letterSpacing}
        fill="currentColor"
        dominantBaseline="central"
      >
        {text}
      </text>
    </svg>
  );
};

export default SvgTextLogo;
