rowboat/apps/rowboat/app/projects/select/components/search-projects.tsx

56 lines
1.7 KiB
TypeScript
Raw Normal View History

2025-04-10 11:44:22 +05:30
import { Project } from "@/app/lib/types/project_types";
2025-03-27 18:52:17 +05:30
import { z } from "zod";
import { ProjectList } from "./project-list";
import { SectionHeading } from "@/components/ui/section-heading";
import { HorizontalDivider } from "@/components/ui/horizontal-divider";
import clsx from 'clsx';
2025-04-10 11:44:22 +05:30
import { XMarkIcon } from "@heroicons/react/24/outline";
2025-03-27 18:52:17 +05:30
interface SearchProjectsProps {
projects: z.infer<typeof Project>[];
isLoading: boolean;
heading: string;
2025-04-10 16:25:20 +05:30
subheading?: string;
2025-03-27 18:52:17 +05:30
className?: string;
2025-04-10 11:44:22 +05:30
onClose?: () => void;
2025-03-27 18:52:17 +05:30
}
export function SearchProjects({
projects,
isLoading,
heading,
subheading,
2025-04-10 11:44:22 +05:30
className,
onClose
2025-03-27 18:52:17 +05:30
}: SearchProjectsProps) {
return (
<div className={clsx("card", className)}>
<div className="px-4 pt-4 pb-6 flex-none">
2025-04-10 11:44:22 +05:30
<div className="flex justify-between items-center">
<SectionHeading
subheading={subheading}
>
{heading}
</SectionHeading>
{onClose && (
<button
onClick={onClose}
className="text-gray-500 hover:text-gray-700"
>
<XMarkIcon className="w-5 h-5" />
</button>
)}
</div>
2025-03-27 18:52:17 +05:30
</div>
<HorizontalDivider />
<div className="flex-1 overflow-hidden">
<ProjectList
projects={projects}
isLoading={isLoading}
searchQuery=""
/>
</div>
</div>
);
}