mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 00:19:08 +00:00
Show ordered issue cards and open counts on the project homepage behind the issuesInbox flag.
60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
import Link from 'next/link'
|
|
import type { ReactNode } from 'react'
|
|
import { Card, CardContent, CardHeader, CardTitle, cn } from 'ui'
|
|
|
|
const STRETCHED_TARGET_CLASS =
|
|
'block w-full truncate text-left outline-hidden after:absolute after:inset-0 after:rounded-lg focus-visible:after:ring-1 focus-visible:after:ring-foreground-muted'
|
|
|
|
type HomeCardTarget = { href: string; onClick?: () => void } | { onClick: () => void; href?: never }
|
|
|
|
type HomeCardProps = HomeCardTarget & {
|
|
icon: ReactNode
|
|
label: string
|
|
title: string
|
|
actions?: ReactNode
|
|
description?: ReactNode
|
|
meta?: ReactNode
|
|
className?: string
|
|
}
|
|
|
|
export const HomeCard = ({
|
|
href,
|
|
onClick,
|
|
icon,
|
|
label,
|
|
title,
|
|
actions,
|
|
description,
|
|
meta,
|
|
className,
|
|
}: HomeCardProps) => (
|
|
<Card className={cn('relative h-64 flex flex-col', className)}>
|
|
<CardHeader className="border-b-0 shrink-0 flex flex-row gap-2 space-y-0 justify-between items-center">
|
|
<div className="flex flex-row items-center gap-3">
|
|
{icon}
|
|
<CardTitle className="text-foreground-light">{label}</CardTitle>
|
|
</div>
|
|
{actions && <div className="relative z-10 flex items-center gap-1">{actions}</div>}
|
|
</CardHeader>
|
|
<CardContent className="pt-0 flex flex-col justify-end flex-1 min-h-0">
|
|
<h3 className="mb-1">
|
|
{href !== undefined ? (
|
|
<Link href={href} onClick={onClick} className={STRETCHED_TARGET_CLASS}>
|
|
{title}
|
|
</Link>
|
|
) : (
|
|
<button type="button" tabIndex={0} onClick={onClick} className={STRETCHED_TARGET_CLASS}>
|
|
{title}
|
|
</button>
|
|
)}
|
|
</h3>
|
|
{description && (
|
|
<div className="text-sm text-muted-foreground line-clamp-3 [&_a]:relative [&_a]:z-10">
|
|
{description}
|
|
</div>
|
|
)}
|
|
{meta && <p className="mt-3 text-sm text-foreground-lighter">{meta}</p>}
|
|
</CardContent>
|
|
</Card>
|
|
)
|