mirror of
https://github.com/supabase/supabase.git
synced 2026-05-22 17:00:43 +08:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import type { ReactNode } from 'react'
|
|
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
|
|
|
|
import { ProjectCommandItem } from './ProjectCommandItem'
|
|
import type { OrgProject } from '@/data/projects/org-projects-infinite-query'
|
|
|
|
export interface EmbeddedProjectListProps {
|
|
projects: OrgProject[]
|
|
selectedRef: string | undefined
|
|
onSelect?: (project: OrgProject) => void
|
|
onClose: () => void
|
|
renderRow?: (project: OrgProject) => ReactNode
|
|
checkPosition?: 'right' | 'left'
|
|
isOptionDisabled?: (project: OrgProject) => boolean
|
|
sentinelRef: (node: Element | null) => void
|
|
hasNextPage: boolean
|
|
}
|
|
|
|
export function EmbeddedProjectList({
|
|
projects,
|
|
selectedRef,
|
|
onSelect,
|
|
onClose,
|
|
renderRow,
|
|
checkPosition,
|
|
isOptionDisabled,
|
|
sentinelRef,
|
|
hasNextPage,
|
|
}: EmbeddedProjectListProps) {
|
|
return (
|
|
<div className="min-h-0 p-1">
|
|
{projects.map((project) => (
|
|
<ProjectCommandItem
|
|
key={project.ref}
|
|
project={project}
|
|
selectedRef={selectedRef}
|
|
onSelect={onSelect}
|
|
onClose={onClose}
|
|
renderRow={renderRow}
|
|
checkPosition={checkPosition}
|
|
isOptionDisabled={isOptionDisabled}
|
|
/>
|
|
))}
|
|
<div ref={sentinelRef} className="h-1 -mt-1" />
|
|
{hasNextPage && (
|
|
<div className="px-2 py-1">
|
|
<ShimmeringLoader className="py-2" />
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|