mirror of
https://github.com/supabase/supabase.git
synced 2026-07-05 17:04:33 +08:00
* init layouts in project settings
* Update general.tsx
* update gap
* Update Scaffold.tsx
* Update PostgrestConfig.tsx
* Update PostgrestConfig.tsx
* spacing issues
* now added a enabled switch
* Revert "now added a enabled switch"
This reverts commit f22050302a.
* Update PostgrestConfig.tsx
* Update PostgrestConfig.tsx
* revert
* Update project-postgrest-config-update-mutation.ts
* add bottom padding
* Update PostgrestConfig.tsx
* Update PostgrestConfig.tsx
* fix
* Update PostgrestConfig.tsx
* Update PostgrestConfig.tsx
* Update PostgrestConfig.tsx
* Update PostgrestConfig.tsx
* Update PostgrestConfig.tsx
* add collapible
* update FormPanel component to be more composable
* Update PostgrestConfig.tsx
* Update PostgrestConfig.tsx
* update callout to warning variant
* Update FormLayout.tsx
* Update PostgrestConfig.tsx
* Small copy changes
---------
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
67 lines
1.9 KiB
TypeScript
67 lines
1.9 KiB
TypeScript
import { HTMLAttributes, forwardRef } from 'react'
|
|
import { cn } from 'ui'
|
|
|
|
interface Props {
|
|
children: React.ReactNode
|
|
header?: React.ReactNode
|
|
footer?: React.ReactNode
|
|
/**
|
|
* Fades the panel and clicks are disabled
|
|
*/
|
|
disabled?: boolean
|
|
}
|
|
|
|
const FormPanel = ({ children, header, footer }: Props) => (
|
|
<FormPanelContainer>
|
|
{header && <FormPanelHeader>{header}</FormPanelHeader>}
|
|
<FormPanelContent className="divide-y">{children}</FormPanelContent>
|
|
{footer && <FormPanelFooter>{footer}</FormPanelFooter>}
|
|
</FormPanelContainer>
|
|
)
|
|
|
|
const FormPanelContainer = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
({ children, ...props }, ref) => (
|
|
<div
|
|
ref={ref}
|
|
{...props}
|
|
className={cn('bg-surface-100 border overflow-hidden rounded-md shadow', props.className)}
|
|
>
|
|
{children}
|
|
</div>
|
|
)
|
|
)
|
|
|
|
FormPanelContainer.displayName = FormPanelContainer.displayName
|
|
|
|
const FormPanelHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
({ children, ...props }, ref) => (
|
|
<div ref={ref} {...props} className={cn('border-default border-b px-8 py-4', props.className)}>
|
|
{children}
|
|
</div>
|
|
)
|
|
)
|
|
|
|
FormPanelHeader.displayName = FormPanelHeader.displayName
|
|
|
|
const FormPanelContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
({ children, ...props }, ref) => (
|
|
<div ref={ref} {...props} className={cn('divide-border flex flex-col gap-0', props.className)}>
|
|
{children}
|
|
</div>
|
|
)
|
|
)
|
|
|
|
FormPanelContent.displayName = FormPanelContent.displayName
|
|
|
|
const FormPanelFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
({ children, ...props }, ref) => (
|
|
<div ref={ref} {...props} className={cn('border-t', props.className)}>
|
|
{children}
|
|
</div>
|
|
)
|
|
)
|
|
|
|
FormPanelFooter.displayName = FormPanelFooter.displayName
|
|
|
|
export { FormPanel, FormPanelContainer, FormPanelContent, FormPanelHeader, FormPanelFooter }
|