import { text } from "../lib/config";
import { format } from "../lib/format";

/** "2 empty rows hidden" under the table (Table › Hide empty rows). */
export function HiddenNote({ data }) {
  const hidden = (data && data.hidden_empty_rows) || [];

  if (!hidden.length) {
    return null;
  }

  return (
    <p className="pcfw-table__hidden">
      {format(
        hidden.length === 1
          ? text("hiddenOne", "%d empty row hidden")
          : text("hiddenMany", "%d empty rows hidden"),
        hidden.length,
      )}
    </p>
  );
}
