/
index.tsx
78 lines (73 loc) · 1.88 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import cn from 'clsx'
import Link from 'next/link'
import styles from './style.module.css'
export function Card({ children, title, icon, image, arrow, href, ...props }) {
const animatedArrow = arrow ? (
<span
className={cn(
'transition-transform duration-75',
'group-hover:translate-x-[2px]'
)}
>
→
</span>
) : null
if (image) {
return (
<Link href={href}>
<a
className={cn(
styles.card,
'group flex flex-col justify-start text-current rounded-lg overflow-hidden shadow shadow-gray-200 border border-transparent bg-gray-100 no-underline transition-all duration-200',
'hover:border-gray-200 hover:shadow-lg hover:shadow-gray-200'
)}
{...props}
>
{children}
<span
className={cn(
styles.title,
'p-4 text-gray-700 gap-1',
'hover:text-gray-900'
)}
>
{icon}
{title}
{animatedArrow}
</span>
</a>
</Link>
)
}
return (
<Link href={href}>
<a
className={cn(
styles.card,
'group flex flex-col justify-start text-current rounded-lg overflow-hidden shadow shadow-transparent border border-transparent bg-gray-100 no-underline transition-all duration-200',
'hover:border-gray-200 hover:shadow-md hover:shadow-gray-100'
)}
{...props}
>
<span
className={cn(
styles.title,
'p-4 text-gray-700 gap-1',
'hover:text-gray-900'
)}
>
{icon}
{title}
{animatedArrow}
</span>
</a>
</Link>
)
}
export function Cards({ children, ...props }) {
return (
<div className={cn(styles.cards, 'gap-4 mt-4')} {...props}>
{children}
</div>
)
}