import { useMemo } from "react";
import { VirtualIconGrid } from "./VirtualIconGrid";
import { IconType } from "./types";
import { getAllIcons } from "./utils";

/**
 * IconGrid is a wrapper component that prepares all icons
 * and passes them to the virtualized grid.
 */
export function IconGrid() {
  // Memoize to avoid recomputation on every render
  const allIcons: IconType[] = useMemo(() => getAllIcons(), []);

  return <VirtualIconGrid allIcons={allIcons} />;
}
