import { fetchProjectCategories, fetchProjects } from "@/app/api/projects";
import React from "react";
import ProjectSearch from "./ProjectSearch";
import ProjectSearchLoading from "./ProjectSearchLoading";

interface SubComponents {
  Loading: typeof ProjectSearchLoading;
}

const ProjectSearchWrapper: React.FC & SubComponents = async () => {
  const projectCategories = await fetchProjectCategories();
  const projects = await fetchProjects();

  return <ProjectSearch projects={projects} projectCategories={projectCategories} />;
};

ProjectSearchWrapper.Loading = ProjectSearchLoading;

export default ProjectSearchWrapper;
