import type { ElementType, ReactNode } from "react";

type ContainerVariant = "default" | "narrow" | "wide";

interface ContainerProps {
  children: ReactNode;
  className?: string;
  as?: ElementType;
  variant?: ContainerVariant;
}

export function Container({
  children,
  className = "",
  as: Tag = "div",
  variant = "default",
}: ContainerProps) {
  const variantClasses: Record<ContainerVariant, string> = {
    default: "container",
    narrow: "container container--narrow",
    wide: "container container--wide",
  };

  return (
    <Tag className={`${variantClasses[variant]} ${className}`.trim()}>
      {children}
    </Tag>
  );
}
