forked from layer5io/layer5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.js
180 lines (172 loc) · 5.31 KB
/
code.js
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import React, { useState } from "react";
import { navigate } from "gatsby";
import { useLocation } from "@reach/router";
import { Pagination, SistentThemeProvider } from "@layer5/sistent";
import { SistentLayout } from "../../sistent-layout";
import { CodeBlock } from "../button/code-block";
import TabButton from "../../../../../reusecore/Button";
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode";
const codes = [
// Basic pagination
`
<Pagination
count={10}
page={1}
onChange={(event, page) => handleChange(page)}
/>
`,
// Pagination with size variants
`
<Pagination size="small" count={10} />
<Pagination size="medium" count={10} />
<Pagination size="large" count={10} />
`,
// Pagination with custom styling
`
<Pagination
count={10}
color="primary"
variant="outlined"
shape="rounded"
/>
`,
// Pagination with an outline
`
<Pagination
count={10}
variant="outlined"
color="secondary"
/>
`,
];
const PaginationCode = () => {
const { isDark } = useStyledDarkMode();
const location = useLocation();
const [currentPage, setCurrentPage] = useState(1);
const handlePageChange = (event, value) => {
setCurrentPage(value);
};
return (
<SistentLayout title="Pagination">
<div className="content">
<a id="Identity">
<h2>Pagination</h2>
</a>
<p>
The Pagination component helps users navigate through multiple pages
of content. It provides a clear interface for moving between pages and
understanding the current position within a larger dataset.
</p>
<div className="filterBtns">
<TabButton
className={
location.pathname === "/projects/sistent/components/pagination"
? "active"
: ""
}
onClick={() => navigate("/projects/sistent/components/pagination")}
title="Overview"
/>
<TabButton
className={
location.pathname ===
"/projects/sistent/components/pagination/guidance"
? "active"
: ""
}
onClick={() =>
navigate("/projects/sistent/components/pagination/guidance")
}
title="Guidance"
/>
<TabButton
className={
location.pathname ===
"/projects/sistent/components/pagination/code"
? "active"
: ""
}
onClick={() =>
navigate("/projects/sistent/components/pagination/code")
}
title="Code"
/>
</div>
<div className="main-content">
{/* Basic Pagination */}
<a id="Basic Pagination">
<h3>Basic Pagination</h3>
</a>
<div className="showcase">
<div className="items">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Pagination
count={10}
page={currentPage}
onChange={handlePageChange}
/>
</SistentThemeProvider>
</div>
<CodeBlock name="basic-pagination" code={codes[0]} />
</div>
{/* Pagination Sizes */}
<a id="Sizes">
<h3>Pagination Sizes</h3>
</a>
<div className="showcase">
<div className="items">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<div
style={{
display: "flex",
flexDirection: "column",
gap: "1rem",
}}
>
<Pagination size="small" count={10} />
<Pagination size="medium" count={10} />
<Pagination size="large" count={10} />
</div>
</SistentThemeProvider>
</div>
<CodeBlock name="pagination-sizes" code={codes[1]} />
</div>
{/* Custom Styling */}
<a id="Styling">
<h3>Custom Styling</h3>
</a>
<div className="showcase">
<div className="items">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Pagination
count={10}
color="primary"
variant="outlined"
shape="rounded"
/>
</SistentThemeProvider>
</div>
<CodeBlock name="styled-pagination" code={codes[2]} />
</div>
{/* Pagination with Outline */}
<a id="Outline">
<h3>Pagination with Outline</h3>
</a>
<div className="showcase">
<div className="items">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Pagination
count={10}
variant="outlined"
color="secondary"
/>
</SistentThemeProvider>
</div>
<CodeBlock name="pagination-outline" code={codes[3]} />
</div>
</div>
</div>
</SistentLayout>
);
};
export default PaginationCode;