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
use dioxus::{prelude::*};
#[allow(non_snake_case,dead_code)]
#[inline_props]
pub fn PfTabs<'a>(cx: Scope<'a>, selected_contents: UseState<String>, children: Element<'a>) -> Element<'a> {
cx.render(rsx! {
div { class: "pf-c-tabs",
button { class: "pf-c-tabs__scroll-button", r#type: "button", disabled: "false", aria_hidden: "false", aria_label: "Scroll left",
i { class: "fas fa-angle-left", aria_hidden: "true" }
}
ul { class: "pf-c-tabs__list",
children
}
}
section {
class: "pf-c-tab-content",
role: "tabpanel",
hidden: "false",
span {
dangerous_inner_html:"{selected_contents}",
}
}
})
}
#[allow(non_snake_case,dead_code)]
#[inline_props]
pub fn PfTab<'a>(cx: Scope<'a>, title: &'a str,selected_contents: UseState<String>, children: Element<'a>) -> Element {
let children_string = dioxus::ssr::render_lazy(rsx!{span{children}});
cx.render(rsx! {
li { class: "pf-c-tabs__item",
button { r#type: "button", class: "pf-c-tabs__link", onclick: move |_| {selected_contents.set(children_string.clone());} , "{title}"
span { class: "pf-c-tabs__item-text"}
}
}
})
}