11'use client' ;
22
3+ import { Loader2Icon } from 'lucide-react' ;
34import { useParams , useRouter } from 'next/navigation' ;
5+ import { Select , SelectList , SelectOption , SelectTrigger } from '@/components/ui/Select' ;
46import { parseDocsPathParams } from '@/util/parseDocsPathParams' ;
5- import { Select , SelectList , SelectOption , SelectTrigger } from './ui/Select' ;
67
7- export function EntryPointSelect ( { entryPoints } : { readonly entryPoints : { readonly entryPoint : string } [ ] } ) {
8+ export function EntryPointSelect ( {
9+ entryPoints,
10+ isLoading,
11+ } : {
12+ readonly entryPoints : { readonly entryPoint : string } [ ] ;
13+ readonly isLoading : boolean ;
14+ } ) {
815 const router = useRouter ( ) ;
916 const params = useParams < {
1017 item ?: string [ ] | undefined ;
@@ -16,11 +23,24 @@ export function EntryPointSelect({ entryPoints }: { readonly entryPoints: { read
1623
1724 return (
1825 < Select
19- aria-label = " Select an entrypoint"
26+ aria-label = { isLoading ? 'Loading entrypoints...' : ' Select an entrypoint' }
2027 defaultSelectedKey = { parsedEntrypoints . join ( '/' ) }
2128 key = { parsedEntrypoints . join ( '/' ) }
29+ placeholder = { isLoading ? 'Loading entrypoints...' : 'Select an entrypoint' }
2230 >
23- < SelectTrigger className = "bg-[#f3f3f4] dark:bg-[#121214]" />
31+ < SelectTrigger
32+ className = "bg-[#f3f3f4] dark:bg-[#121214]"
33+ suffix = {
34+ isLoading ? (
35+ < Loader2Icon
36+ aria-hidden
37+ className = "size-6 shrink-0 animate-spin duration-200 forced-colors:text-[ButtonText] forced-colors:group-disabled:text-[GrayText]"
38+ size = { 24 }
39+ strokeWidth = { 1.5 }
40+ />
41+ ) : null
42+ }
43+ />
2444 < SelectList classNames = { { popover : 'bg-[#f3f3f4] dark:bg-[#28282d]' } } items = { entryPoints } >
2545 { ( item ) => (
2646 < SelectOption
0 commit comments