Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mastodon
GitHub Repository: mastodon/joinmastodon
Path: blob/main/components/IconCard.tsx
1006 views
1
import Image from "next/legacy/image"
2
3
export type IconCardProps = {
4
/** Card's heading */
5
title: React.ReactNode
6
/** Card's visual element, using a predefined set of icons */
7
icon: string
8
/** Card's copy */
9
copy: React.ReactNode
10
/** Extra class names, used for homepage carousel */
11
className?: string
12
}
13
/**
14
* Renders a feature card with a visual element and copy.
15
* Layout (width, height, positioning) can be set from the parent.
16
*/
17
export const IconCard = ({ title, icon, copy, className }: IconCardProps) => {
18
return (
19
<div
20
className={`flex flex-col items-center justify-start overflow-hidden rounded bg-white text-center ${className}`}
21
>
22
<div className="flex h-44 w-full items-center justify-center text-blurple-500">
23
<div className="relative h-[7.5rem] w-[7.5rem]">
24
<Image
25
src={require(`../public/icons/${icon}.svg`)}
26
layout="fill"
27
alt=""
28
/>
29
</div>
30
</div>
31
<div className="flex flex-col gap-2 p-8 pt-0">
32
<h3 className="h5">{title}</h3>
33
<p className="b2 text-gray-1">{copy}</p>
34
</div>
35
</div>
36
)
37
}
38
39