import React, { FC } from 'react' import { IconChevronRight } from '@supabase/ui' import Link from 'next/link' interface Props { title: string | React.ReactNode description?: string children?: React.ReactNode footer?: React.ReactNode url?: string linkHref?: string imgUrl?: string imgAlt?: string onClick?: () => void icon?: React.ReactNode containerHeightClassName?: string } const CardButton: FC = ({ title, description, children, footer, url = '', linkHref = '', imgUrl, imgAlt, onClick, icon, containerHeightClassName = 'h-32', }) => { const LinkContainer = ({ children }: { children: React.ReactNode }) => ( {children} ) const UrlContainer = ({ children }: { children: React.ReactNode }) => {children} const NonLinkContainer = ({ children }: { children: React.ReactNode }) =>
{children}
const ButtonContainer = ({ children }: { children: React.ReactNode }) => ( ) const isLink = url || linkHref || onClick let containerClasses = [ 'group relative text-left', 'bg-panel-header-light dark:bg-panel-header-dark', 'border border-panel-border-light dark:border-panel-border-dark', 'rounded-md py-4 px-6 flex flex-row', 'transition ease-in-out duration-150', containerHeightClassName, ] if (isLink) { containerClasses = [ ...containerClasses, 'cursor-pointer', 'hover:bg-panel-border-light dark:hover:bg-panel-border-dark', 'hover:border-panel-border-hover-light', 'dark:hover:border-panel-border-hover-dark hover:border-gray-300', ] } const ImageContainer = ({ children }: { children: React.ReactNode }) => { return
{children}
} const contents = (
{imgUrl && ( {`${imgAlt}`} )} {icon && {icon}}
{title}

{description}

{children && children}
{footer && footer}
{isLink && (
)}
) if (onClick) { return } else if (linkHref) { return } else if (url) { return } else { return } } export default CardButton