mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 01:10:15 -04:00
05a542ccea
* Add lucide-react to docs (to make the autocomplete work). * Migrate the docs app icons. * Migrate the ui-patterns. * Remove the old icons from ui package. * Migrate the www app from react-feather icons. * Migrate all of studio icons. * Migrate the only component in design-system. * Fix an old import in ui package. Revert an import in docs app. * Fix some pages in www. * Remove unneeded files used in generation of icons. * Fix a prettier error. * Fix more issues in www. * Fix an issue in Log Date picker. * Replace all string sizes with number sizes because the icons grew in some cases. * Fix more imports in security page. * Fix an extra import. * Remove the size prop from all icons if they're in a button and they match the button size. * Minor fixes for docs and www. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { XCircle } from 'lucide-react'
|
|
import { type FC, type PropsWithChildren, useState } from 'react'
|
|
import { CollapsibleContent_Shadcn_, CollapsibleTrigger_Shadcn_, Collapsible_Shadcn_, 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_Shadcn_ open={open} onOpenChange={setOpen} className="mt-0">
|
|
<CollapsibleTrigger_Shadcn_ 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_Shadcn_>
|
|
<CollapsibleContent_Shadcn_>{props.children}</CollapsibleContent_Shadcn_>
|
|
</Collapsible_Shadcn_>
|
|
)
|
|
}
|
|
|
|
ApiSchemaOptions.Option = ApiSchema
|
|
|
|
export default ApiSchemaOptions
|