mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 04:45:08 +03:00
* privatelink integration * mock queries * add integration endpoints * poll for updates on transition states * prevent ui for multiple posts * changes to copy for existing accounts * update privatelink documentation * hide privatelink for customer under Team plan * added connected state tip * linting fixes * fixed issue due to merge * Add cc feature flag * Nit clean up * Small revert * Nudge UI a little * Update react queries to fit new structure * Fix * Clean up * nit * revert padding * Fix * fix: tanstack changes * added feature to pricing page * Update apps/docs/content/guides/platform/privatelink.mdx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: dropdown copy change * Update apps/docs/content/guides/platform/privatelink.mdx Co-authored-by: Chris Chinchilla <chris.ward@supabase.io> * Update apps/docs/content/guides/platform/privatelink.mdx Co-authored-by: Chris Chinchilla <chris.ward@supabase.io> * Smol clean up --------- Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
81 lines
2.2 KiB
TypeScript
81 lines
2.2 KiB
TypeScript
import { ChevronRight, MoreVertical } from 'lucide-react'
|
|
import { forwardRef, HTMLAttributes, ReactNode } from 'react'
|
|
|
|
import {
|
|
Button,
|
|
CardContent,
|
|
cn,
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
} from 'ui'
|
|
|
|
export interface ResourceAction {
|
|
label: string
|
|
onClick: () => void
|
|
}
|
|
|
|
export interface ResourceItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
media?: ReactNode
|
|
meta?: ReactNode
|
|
onClick?: () => void
|
|
children?: ReactNode
|
|
actions?: ResourceAction[]
|
|
}
|
|
|
|
export const ResourceItem = forwardRef<HTMLDivElement, ResourceItemProps>(
|
|
({ media, meta, onClick, children, className, actions, ...props }, ref) => {
|
|
return (
|
|
<CardContent
|
|
ref={ref}
|
|
className={cn(
|
|
'flex items-center justify-between text-sm gap-4',
|
|
'!border-b-0',
|
|
onClick && 'cursor-pointer hover:bg-surface-200',
|
|
className
|
|
)}
|
|
onClick={onClick}
|
|
{...props}
|
|
>
|
|
{media && (
|
|
<div className="text-foreground-light flex items-center justify-center">{media}</div>
|
|
)}
|
|
<div className="flex-1">{children}</div>
|
|
{meta && <div>{meta}</div>}
|
|
{actions && actions.length > 0 ? (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button
|
|
type="text"
|
|
className="px-1"
|
|
icon={<MoreVertical size={16} />}
|
|
onClick={(e) => {
|
|
e.stopPropagation()
|
|
}}
|
|
/>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="end">
|
|
{actions.map((action) => (
|
|
<DropdownMenuItem
|
|
key={action.label}
|
|
onClick={(e) => {
|
|
e.stopPropagation()
|
|
action.onClick()
|
|
}}
|
|
>
|
|
{action.label}
|
|
</DropdownMenuItem>
|
|
))}
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
) : (
|
|
onClick && <ChevronRight strokeWidth={1.5} size={16} />
|
|
)}
|
|
</CardContent>
|
|
)
|
|
}
|
|
)
|
|
|
|
ResourceItem.displayName = 'ResourceItem'
|