mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 23:29:08 +03:00
* 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>
88 lines
3.1 KiB
TypeScript
88 lines
3.1 KiB
TypeScript
import * as Tooltip from '@radix-ui/react-tooltip'
|
|
import { ExternalLink } from 'lucide-react'
|
|
import { PropsWithChildren } from 'react'
|
|
import { Button } from 'ui'
|
|
|
|
interface ProductEmptyStateProps {
|
|
title?: string
|
|
size?: 'medium' | 'large'
|
|
ctaButtonLabel?: string
|
|
infoButtonLabel?: string
|
|
infoButtonUrl?: string
|
|
onClickCta?: () => void
|
|
loading?: boolean
|
|
disabled?: boolean
|
|
disabledMessage?: string
|
|
}
|
|
|
|
const ProductEmptyState = ({
|
|
title = '',
|
|
size = 'medium',
|
|
children,
|
|
ctaButtonLabel = '',
|
|
infoButtonLabel = '',
|
|
infoButtonUrl = '',
|
|
onClickCta = () => {},
|
|
loading = false,
|
|
disabled = false,
|
|
disabledMessage = '',
|
|
}: PropsWithChildren<ProductEmptyStateProps>) => {
|
|
const hasAction = (ctaButtonLabel && onClickCta) || (infoButtonUrl && infoButtonLabel)
|
|
|
|
return (
|
|
<div className="flex h-full w-full items-center justify-center">
|
|
<div className="flex space-x-4 rounded border bg-surface-100 p-6 shadow-md">
|
|
{/* A graphic can probably be placed here as a sibling to the div below*/}
|
|
<div className="flex flex-col">
|
|
<div className={`${size === 'medium' ? 'w-80' : 'w-[400px]'} space-y-4`}>
|
|
<h5 className="text-foreground">{title}</h5>
|
|
<div className="flex flex-col space-y-2 text-foreground-light">{children}</div>
|
|
{hasAction && (
|
|
<div className="flex items-center space-x-2">
|
|
{ctaButtonLabel && onClickCta && (
|
|
<Tooltip.Root delayDuration={0}>
|
|
<Tooltip.Trigger asChild>
|
|
<Button
|
|
type="primary"
|
|
onClick={onClickCta}
|
|
loading={loading}
|
|
disabled={loading || disabled}
|
|
>
|
|
{ctaButtonLabel}
|
|
</Button>
|
|
</Tooltip.Trigger>
|
|
{disabled && disabledMessage.length > 0 && (
|
|
<Tooltip.Portal>
|
|
<Tooltip.Content side="bottom">
|
|
<Tooltip.Arrow className="radix-tooltip-arrow" />
|
|
<div
|
|
className={[
|
|
'rounded bg-alternative py-1 px-2 leading-none shadow',
|
|
'border border-background',
|
|
].join(' ')}
|
|
>
|
|
<span className="text-xs text-foreground">{disabledMessage}</span>
|
|
</div>
|
|
</Tooltip.Content>
|
|
</Tooltip.Portal>
|
|
)}
|
|
</Tooltip.Root>
|
|
)}
|
|
{infoButtonUrl && infoButtonLabel ? (
|
|
<Button type="default" icon={<ExternalLink strokeWidth={1.5} />}>
|
|
<a target="_blank" rel="noreferrer" href={infoButtonUrl}>
|
|
{infoButtonLabel}
|
|
</a>
|
|
</Button>
|
|
) : null}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ProductEmptyState
|