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
#![allow(non_snake_case)]
use dioxus::prelude::*;
#[derive(Props, Clone, PartialEq)]
pub struct PaginationProps {
next_page_url: Option<String>,
prev_page_url: Option<String>,
}
#[component]
pub fn Pagination(props: PaginationProps) -> Element {
rsx!(
nav {
class: "paginate-container",
"aria-label": "Pagination",
div {
class: "pagination",
if let Some(url) = props.prev_page_url {
a {
class: "previous_page",
rel: "previous",
href: "{url}",
"Previous"
}
} else {
span {
class: "previous_page",
"aria-disabled": "true",
"Previous"
}
}
if let Some(url) = props.next_page_url {
a {
class: "next_page",
rel: "next",
href: "{url}",
"Next"
}
} else {
span {
class: "next_page",
"aria-disabled": "true",
"Next"
}
}
}
}
)
}