|
1
|
import { TriangleLeftMini, TriangleRightMini } from "@medusajs/icons" |
|
2
|
import clsx from "clsx" |
|
3
|
import Link from "next/link" |
|
4
|
import React from "react" |
|
5
|
|
|
6
|
type PaginationCardProps = { |
|
7
|
type: "previous" | "next" |
|
8
|
title: string |
|
9
|
parentTitle?: string |
|
10
|
link: string |
|
11
|
className?: string |
|
12
|
} |
|
13
|
|
|
14
|
export const PaginationCard = ({ |
|
15
|
type, |
|
16
|
title, |
|
17
|
parentTitle, |
|
18
|
link, |
|
19
|
className, |
|
20
|
}: PaginationCardProps) => { |
|
21
|
return ( |
|
22
|
<div |
|
23
|
className={clsx( |
|
24
|
"relative flex-1", |
|
25
|
"py-docs_0.5 px-docs_0.75 rounded", |
|
26
|
"bg-medusa-bg-component hover:bg-medusa-bg-component-hover", |
|
27
|
"shadow-elevation-card-rest dark:shadow-elevation-card-rest-dark", |
|
28
|
"hover:shadow-elevation-card-hover dark:shadow-elevation-card-hover-dark", |
|
29
|
className |
|
30
|
)} |
|
31
|
data-testid="pagination-card" |
|
32
|
> |
|
33
|
<Link |
|
34
|
href={link} |
|
35
|
className="absolute top-0 left-0 w-full h-full" |
|
36
|
data-testid="pagination-card-link" |
|
37
|
/> |
|
38
|
<div |
|
39
|
className={clsx("h-[40px] flex gap-docs_0.75 items-center")} |
|
40
|
data-testid="pagination-card-content" |
|
41
|
> |
|
42
|
{type === "previous" && ( |
|
43
|
<TriangleLeftMini |
|
44
|
className="text-medusa-fg-muted" |
|
45
|
data-testid="pagination-card-previous-icon" |
|
46
|
/> |
|
47
|
)} |
|
48
|
<div |
|
49
|
className={clsx( |
|
50
|
"flex-1", |
|
51
|
type === "previous" && "text-left", |
|
52
|
type === "next" && "text-right" |
|
53
|
)} |
|
54
|
data-testid="pagination-card-title-wrapper" |
|
55
|
> |
|
56
|
{parentTitle && ( |
|
57
|
<span |
|
58
|
className="block text-compact-small text-medusa-fg-subtle" |
|
59
|
data-testid="pagination-card-parent-title" |
|
60
|
> |
|
61
|
{parentTitle} |
|
62
|
</span> |
|
63
|
)} |
|
64
|
<span |
|
65
|
className="block text-compact-small-plus text-medusa-fg-base" |
|
66
|
data-testid="pagination-card-title" |
|
67
|
> |
|
68
|
{title} |
|
69
|
</span> |
|
70
|
</div> |
|
71
|
{type === "next" && ( |
|
72
|
<TriangleRightMini |
|
73
|
className="text-medusa-fg-muted" |
|
74
|
data-testid="pagination-card-next-icon" |
|
75
|
/> |
|
76
|
)} |
|
77
|
</div> |
|
78
|
</div> |
|
79
|
) |
|
80
|
} |