mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 19:05:06 +03:00
## Problem The `_Shadcn_` suffix isn't needed anymore on `Command` components ## Solution - Remove the `_Shadcn_` suffix - Simplify UI package exports - Apply prettier <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Simplified command component imports and exports across the UI library by removing internal naming aliases and adopting direct component references. Updated the public UI package barrel export to use wildcard re-exports for cleaner API surface. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46153?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import { Check } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { cn, CommandItem } from 'ui'
|
|
|
|
import PartnerIcon from '@/components/ui/PartnerIcon'
|
|
import type { Organization } from '@/types'
|
|
|
|
export interface OrgCommandItemProps {
|
|
org: Organization
|
|
selectedSlug: string | undefined
|
|
routePathname: string
|
|
hasRouteSlug: boolean
|
|
onClose: () => void
|
|
compactPadding?: boolean
|
|
}
|
|
|
|
export function OrgCommandItem({
|
|
org,
|
|
selectedSlug,
|
|
routePathname,
|
|
hasRouteSlug,
|
|
onClose,
|
|
compactPadding = false,
|
|
}: OrgCommandItemProps) {
|
|
const href = hasRouteSlug ? routePathname.replace('[slug]', org.slug) : `/org/${org.slug}`
|
|
|
|
return (
|
|
<CommandItem
|
|
key={org.slug}
|
|
value={`${org.name.replaceAll('"', '')} - ${org.slug}`}
|
|
className="cursor-pointer w-full"
|
|
onSelect={() => onClose()}
|
|
>
|
|
<Link
|
|
href={href}
|
|
className={cn(
|
|
'w-full flex items-center justify-between text-sm md:text-xs',
|
|
!compactPadding && 'p-0.5'
|
|
)}
|
|
>
|
|
<div className="flex items-center gap-2">
|
|
<span>{org.name}</span>
|
|
<PartnerIcon organization={org} />
|
|
</div>
|
|
{org.slug === selectedSlug && <Check size={16} />}
|
|
</Link>
|
|
</CommandItem>
|
|
)
|
|
}
|