import { ReactNode } from "react";

/**
 * SimpleTable
 * -----------
 * Lightweight reusable table shell for desktop-sized admin views.
 * Horizontal overflow is enabled so wider operational tables remain usable on
 * tablet-sized screens without breaking the page layout.
 */
export function SimpleTable({
  headers,
  children,
}: {
  headers: string[];
  children: ReactNode;
}) {
  return (
    <div className="overflow-hidden rounded-2xl border bg-white shadow-sm">
      <div className="overflow-x-auto">
        <table className="min-w-full divide-y">
          <thead className="bg-gray-50">
            <tr>
              {headers.map((header) => (
                <th
                  key={header}
                  className="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-gray-500"
                >
                  {header}
                </th>
              ))}
            </tr>
          </thead>
          <tbody className="divide-y bg-white">{children}</tbody>
        </table>
      </div>
    </div>
  );
}
