Files
supabase/apps/studio/components/ui/AIAssistantPanel/elements/Tool.tsx
Gildas Garcia 0713a1efc1 chore: remove shadcn suffix for Input, Textarea, Alert and Collapsible (#45867)
## Problem

Now that we migrated old components to their new shadcn alternatives, we
don't need the `_Shadcn_` suffix anymore.

## Solution

Remove it

<img width="659" height="609" alt="image"
src="https://github.com/user-attachments/assets/2d7271a9-066a-4dcc-92fe-729b106d2c2f"
/>
2026-05-15 14:55:37 +02:00

49 lines
1.3 KiB
TypeScript

import type { PropsWithChildren, ReactNode } from 'react'
import { cn, Collapsible, CollapsibleContent, CollapsibleTrigger } from 'ui'
type ToolProps = PropsWithChildren<{
className?: string
label: ReactNode
icon?: ReactNode
}>
export function Tool({ className, label, icon, children }: ToolProps) {
const isCollapsible = !!children
return (
<div
className={cn(
'tool-item text-foreground-lighter flex items-center gap-2 py-2',
'[&:not(.tool-item+.tool-item)]:mt-4 [&:not(:has(+.tool-item))]:mb-4',
'[&:has(+.tool-item)]:border-b [&:has(+.tool-item)]:border-b-muted',
'first:mt-0! last:mb-0',
className
)}
>
<Collapsible>
<CollapsibleTrigger
className={cn('flex items-center gap-2 w-full text-left')}
disabled={!children}
>
{icon}
{typeof label === 'string' ? (
<span className="text-foreground-lighter">{label}</span>
) : (
label
)}
</CollapsibleTrigger>
{isCollapsible && (
<CollapsibleContent
className={cn('pl-6 py-2 text-xs leading-normal', 'max-h-64 overflow-y-auto')}
>
{children}
</CollapsibleContent>
)}
</Collapsible>
</div>
)
}
Tool.displayName = 'Tool'