mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 07:39:07 +03:00
* chore: move column priv * update docs * Minor fixes for column privileges. Add an explanation alert. * Add a right icon to productMenuItem component. * Rename the database replication into publications. * Change the order for the database menu. * Fix various links to db publications. * Remove duplicate entry. --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
69 lines
1.6 KiB
TypeScript
69 lines
1.6 KiB
TypeScript
import Link from 'next/link'
|
|
import { ReactNode } from 'react'
|
|
import { Badge, Button, Menu } from 'ui'
|
|
|
|
interface ProductMenuItemProps {
|
|
name: string | ReactNode
|
|
isActive: boolean
|
|
isExternal?: boolean
|
|
icon?: ReactNode
|
|
rightIcon?: ReactNode
|
|
url?: string
|
|
target?: '_blank' | '_self'
|
|
onClick?: () => void
|
|
textClassName?: string
|
|
hoverText?: string
|
|
label?: string
|
|
}
|
|
|
|
const ProductMenuItem = ({
|
|
name = '',
|
|
isActive,
|
|
isExternal,
|
|
icon,
|
|
rightIcon,
|
|
url = '',
|
|
target = '_self',
|
|
onClick,
|
|
textClassName = '',
|
|
hoverText = '',
|
|
label,
|
|
}: ProductMenuItemProps) => {
|
|
const menuItem = (
|
|
<Menu.Item icon={icon} rounded active={isActive} onClick={onClick}>
|
|
<div className="flex w-full items-center justify-between gap-1">
|
|
<div
|
|
title={hoverText ? hoverText : typeof name === 'string' ? name : ''}
|
|
className={'flex items-center gap-2 truncate w-full ' + textClassName}
|
|
>
|
|
<span className="truncate">{name} </span>
|
|
{label !== undefined && <Badge variant="warning">{label}</Badge>}
|
|
</div>
|
|
{rightIcon && <div>{rightIcon}</div>}
|
|
</div>
|
|
</Menu.Item>
|
|
)
|
|
|
|
if (url) {
|
|
if (isExternal) {
|
|
return (
|
|
<Button asChild block className="!justify-start" type="text" size="small" icon={icon}>
|
|
<Link href={url} target="_blank" rel="noreferrer">
|
|
{name}
|
|
</Link>
|
|
</Button>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Link href={url} className="block" target={target}>
|
|
{menuItem}
|
|
</Link>
|
|
)
|
|
}
|
|
|
|
return menuItem
|
|
}
|
|
|
|
export default ProductMenuItem
|