mirror of
https://github.com/supabase/supabase.git
synced 2026-06-05 04:12:29 +08:00
## 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" />
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { XCircle } from 'lucide-react'
|
|
import { type FC, type PropsWithChildren, useState } from 'react'
|
|
import { CollapsibleContent, CollapsibleTrigger, Collapsible, cn } from 'ui'
|
|
import ApiSchema from '~/components/ApiSchema'
|
|
|
|
interface IOptions {
|
|
name?: string
|
|
}
|
|
|
|
type IOption = any
|
|
|
|
type OptionsSubComponents = {
|
|
Option: IOption
|
|
}
|
|
|
|
const ApiSchemaOptions: FC<PropsWithChildren<IOptions>> & OptionsSubComponents = (props) => {
|
|
const [open, setOpen] = useState(false)
|
|
return (
|
|
<Collapsible open={open} onOpenChange={setOpen} className="mt-0">
|
|
<CollapsibleTrigger asChild>
|
|
<button
|
|
className={cn(
|
|
'px-5',
|
|
'border-t border-l border-r border-default',
|
|
'text-left text-sm text-foreground-light',
|
|
'hover:bg-surface-100 transition-all',
|
|
'flex items-center gap-2',
|
|
open ? 'w-full py-1.5 rounded-tl-lg rounded-tr-lg' : 'py-1 border-b rounded-full'
|
|
)}
|
|
>
|
|
<XCircle size={14} className={open ? '' : 'rotate-45'} />
|
|
{`${!open ? `Open` : `Close`} ${props.name ?? 'object schema'}`}
|
|
</button>
|
|
</CollapsibleTrigger>
|
|
<CollapsibleContent>{props.children}</CollapsibleContent>
|
|
</Collapsible>
|
|
)
|
|
}
|
|
|
|
ApiSchemaOptions.Option = ApiSchema
|
|
|
|
export default ApiSchemaOptions
|