Skip to content

Commit bc5c685

Browse files
committed
Add ResourceHubCard
1 parent d44f4d4 commit bc5c685

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import Link from "next/link"
2+
import { clsx } from "clsx"
3+
4+
import ArrowDownIcon from "@/app/conf/_design-system/pixelarticons/arrow-down.svg?svgr"
5+
import ClockIcon from "@/app/conf/_design-system/pixelarticons/clock.svg?svgr"
6+
import { Tag } from "@/app/conf/_design-system/tag"
7+
8+
interface ResourceHubCardProps {
9+
href: string
10+
title: string
11+
author?: string
12+
duration?: string
13+
tags?: {
14+
label: string
15+
color: string
16+
}[]
17+
className?: string
18+
}
19+
20+
export function ResourceHubCard({
21+
href,
22+
title,
23+
author,
24+
duration,
25+
tags,
26+
className,
27+
}: ResourceHubCardProps) {
28+
return (
29+
<Link
30+
href={href}
31+
className={clsx(
32+
"group flex h-full flex-col border border-neu-200 bg-neu-50 text-left hover:ring hover:ring-neu-100 dark:hover:ring-neu-50",
33+
className,
34+
)}
35+
>
36+
<div className="flex flex-1 flex-col gap-4 border-b border-neu-200 p-4 dark:border-neu-100 md:p-6">
37+
{tags?.length ? (
38+
<div className="flex flex-wrap gap-2">
39+
{tags.map(tag => (
40+
<Tag key={tag.label} color={tag.color}>
41+
{tag.label}
42+
</Tag>
43+
))}
44+
</div>
45+
) : null}
46+
<div className="flex flex-1 flex-col justify-end">
47+
<h3 className="typography-h4 text-pretty text-neu-900 md:typography-h3">
48+
{title}
49+
</h3>
50+
</div>
51+
</div>
52+
<div className="flex items-center">
53+
<div className="flex flex-1 items-center justify-between p-4 md:p-6">
54+
{author && (
55+
<span className="typography-body-sm text-neu-800">{author}</span>
56+
)}
57+
{duration && (
58+
<span className="flex items-center gap-2 text-neu-800">
59+
<ClockIcon className="size-5" />
60+
<span className="typography-body-sm">{duration}</span>
61+
</span>
62+
)}
63+
</div>
64+
<div className="flex size-[53px] items-center justify-center border-l border-neu-200 dark:border-neu-100 md:size-[72px]">
65+
<ArrowDownIcon className="size-8 -rotate-90 md:size-10" aria-hidden />
66+
</div>
67+
</div>
68+
</Link>
69+
)
70+
}

0 commit comments

Comments
 (0)