Card() — supabase Function Reference
Architecture documentation for the Card() function in index.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 09cc6bbd_ff8a_4068_0620_55b8a8b82fa7["Card()"] b4347b35_9662_64c5_5d7f_6532cd5d96f4["useClickableCard()"] 09cc6bbd_ff8a_4068_0620_55b8a8b82fa7 -->|calls| b4347b35_9662_64c5_5d7f_6532cd5d96f4 6215f5f8_959b_0d27_9c02_ce5f395aab88["cn()"] 09cc6bbd_ff8a_4068_0620_55b8a8b82fa7 -->|calls| 6215f5f8_959b_0d27_9c02_ce5f395aab88 style 09cc6bbd_ff8a_4068_0620_55b8a8b82fa7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/cms/src/components/Card/index.tsx lines 20–88
}> = (props) => {
const { card, link } = useClickableCard({})
const { className, doc, relationTo, showCategories, title: titleFromProps } = props
const { slug, categories, meta, title } = doc || {}
const { description, image: metaImage } = meta || {}
const hasCategories = categories && Array.isArray(categories) && categories.length > 0
const titleToUse = titleFromProps || title
const sanitizedDescription = description?.replace(/\s/g, ' ') // replace non-breaking space with white space
const href = `/${relationTo}/${slug}`
return (
<article
className={cn(
'border border-border rounded-lg overflow-hidden bg-card hover:cursor-pointer',
className
)}
ref={card.ref as React.Ref<HTMLDivElement>}
>
<div className="relative w-full ">
{!metaImage && <div className="">No image</div>}
{metaImage && typeof metaImage !== 'string' && <Media resource={metaImage} size="33vw" />}
</div>
<div className="p-4">
{showCategories && hasCategories && (
<div className="uppercase text-sm mb-4">
{showCategories && hasCategories && (
<div>
{categories?.map((category, index) => {
if (typeof category === 'object') {
const { name: nameFromCategory } = category
const categoryName = nameFromCategory || 'Untitled category'
const isLast = index === categories.length - 1
return (
<Fragment key={index}>
{categoryName}
{!isLast && <Fragment>, </Fragment>}
</Fragment>
)
}
return null
})}
</div>
)}
</div>
)}
{titleToUse && (
<div className="prose">
<h3>
<Link
className="not-prose"
href={href}
ref={link.ref as React.Ref<HTMLAnchorElement>}
>
{titleToUse}
</Link>
</h3>
</div>
)}
{description && <div className="mt-2">{description && <p>{sanitizedDescription}</p>}</div>}
</div>
</article>
)
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does Card() do?
Card() is a function in the supabase codebase.
What does Card() call?
Card() calls 2 function(s): cn, useClickableCard.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free