initial commit
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I4a6b498153eccd5407510dd541b7f4816a6a6964
This commit is contained in:
commit
6a73d11c4b
124 changed files with 34856 additions and 0 deletions
42
crates/pinakes-ui/src/components/breadcrumb.rs
Normal file
42
crates/pinakes-ui/src/components/breadcrumb.rs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
use dioxus::prelude::*;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct BreadcrumbItem {
|
||||
pub label: String,
|
||||
pub view: Option<String>,
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn Breadcrumb(
|
||||
items: Vec<BreadcrumbItem>,
|
||||
on_navigate: EventHandler<Option<String>>,
|
||||
) -> Element {
|
||||
rsx! {
|
||||
nav { class: "breadcrumb",
|
||||
for (i, item) in items.iter().enumerate() {
|
||||
if i > 0 {
|
||||
span { class: "breadcrumb-sep", " > " }
|
||||
}
|
||||
if i < items.len() - 1 {
|
||||
{
|
||||
let view = item.view.clone();
|
||||
let label = item.label.clone();
|
||||
rsx! {
|
||||
a {
|
||||
class: "breadcrumb-link",
|
||||
href: "#",
|
||||
onclick: move |e: Event<MouseData>| {
|
||||
e.prevent_default();
|
||||
on_navigate.call(view.clone());
|
||||
},
|
||||
"{label}"
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
span { class: "breadcrumb-current", "{item.label}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue