misc
This commit is contained in:
@@ -19,10 +19,10 @@ pub fn Button(props: ButtonProps) -> Element {
|
||||
rsx! {
|
||||
button {
|
||||
onclick: move |event| {
|
||||
event.prevent_default();
|
||||
if let Some(h) = props.onclick {
|
||||
h.call(event);
|
||||
}
|
||||
event.prevent_default();
|
||||
if let Some(h) = props.onclick {
|
||||
h.call(event);
|
||||
}
|
||||
},
|
||||
"{props.text}"
|
||||
}
|
||||
|
||||
@@ -17,14 +17,18 @@ pub fn Input(props: InputProps) -> Element {
|
||||
let ph = props.placeholder.unwrap_or(label.clone());
|
||||
rsx! {
|
||||
label {
|
||||
"{label}",
|
||||
"{label}"
|
||||
input {
|
||||
type : props.r#type.unwrap_or("text".into()),
|
||||
r#type: props.r#type.unwrap_or("text".into()),
|
||||
value: props.value,
|
||||
oninput: move |e| if let Some(mut s) = props.value { s.set(e.value()); },
|
||||
oninput: move |e| {
|
||||
if let Some(mut s) = props.value {
|
||||
s.set(e.value());
|
||||
}
|
||||
},
|
||||
name: props.name,
|
||||
placeholder:ph,
|
||||
required: props.required
|
||||
placeholder: ph,
|
||||
required: props.required,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ pub fn MediaGrid(props: MediaGridProps) -> Element {
|
||||
match media_result.cloned() {
|
||||
Some(value) => match value {
|
||||
Ok(result) => rsx! {
|
||||
div{
|
||||
div {
|
||||
class: "mediaGrid",
|
||||
{result.items.iter().map(|itm| rsx!{
|
||||
MediaItem { item: itm.clone() }
|
||||
@@ -57,7 +57,7 @@ pub fn MediaGrid(props: MediaGridProps) -> Element {
|
||||
}
|
||||
},
|
||||
Err(msg) => rsx! {
|
||||
div{
|
||||
div {
|
||||
class: "mediaGrid",
|
||||
div {
|
||||
"Failed to load results: {msg}"
|
||||
@@ -69,18 +69,9 @@ pub fn MediaGrid(props: MediaGridProps) -> Element {
|
||||
div{
|
||||
class: "mediaGrid",
|
||||
div {
|
||||
"No results could be loaded"
|
||||
"Loading..."
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn Nested() -> Element {
|
||||
rsx! {
|
||||
div{
|
||||
"test",
|
||||
slot { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,25 +15,13 @@ pub fn MediaItem(props: MediaItemProps) -> Element {
|
||||
|
||||
let src = format!("{HOST}/m/thumb/{id}");
|
||||
rsx! {
|
||||
a{
|
||||
class: "mediaItem",
|
||||
href: "{HOST}/m/{id}",
|
||||
target: "_blank",
|
||||
img{ src: src }
|
||||
span {
|
||||
class: "info",
|
||||
span{
|
||||
class: "name",
|
||||
"{filename}"
|
||||
},
|
||||
span{
|
||||
class: "details",
|
||||
span{
|
||||
"{mtype}"
|
||||
},
|
||||
span{
|
||||
"{props.item.view_count}"
|
||||
},
|
||||
a { class: "mediaItem", href: "{HOST}/m/{id}", target: "_blank",
|
||||
img { src }
|
||||
span { class: "info",
|
||||
span { class: "name", "{filename}" }
|
||||
span { class: "details",
|
||||
span { "{mtype}" }
|
||||
span { "{props.item.view_count}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn MainNaviagation() -> Element {
|
||||
pub fn Branding() -> Element {
|
||||
rsx! {
|
||||
div { class: "branding",
|
||||
img {src: NAV_ICON, alt: "Aoba"}
|
||||
img { src: NAV_ICON, alt: "Aoba" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,10 +50,7 @@ pub fn Utils() -> Element {
|
||||
|
||||
rsx! {
|
||||
div { class: "utils",
|
||||
div{
|
||||
onclick: move |_| auth_context.logout(),
|
||||
"Logout"
|
||||
}
|
||||
}
|
||||
div { onclick: move |_| auth_context.logout(), "Logout" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,20 +25,15 @@ pub fn Notif(props: NotifProps) -> Element {
|
||||
};
|
||||
let m = props.message;
|
||||
rsx! {
|
||||
div{
|
||||
class: "notif {type_class}",
|
||||
div{
|
||||
class: "icon",
|
||||
div { class: "notif {type_class}",
|
||||
div { class: "icon",
|
||||
match t {
|
||||
NotifType::Notice => icons::Error(),
|
||||
NotifType::Error => icons::Error(),
|
||||
NotifType::Warning => icons::Warn(),
|
||||
NotifType::Notice => icons::Error(),
|
||||
NotifType::Error => icons::Error(),
|
||||
NotifType::Warning => icons::Warn(),
|
||||
}
|
||||
}
|
||||
div{
|
||||
class: "message",
|
||||
"{m}"
|
||||
}
|
||||
div { class: "message", "{m}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,12 @@ use dioxus::prelude::*;
|
||||
#[component]
|
||||
pub fn Search(query: Signal<String>) -> Element {
|
||||
rsx! {
|
||||
div{
|
||||
class: "searchBar stickyTop",
|
||||
div { class: "searchBar stickyTop",
|
||||
input {
|
||||
type: "search",
|
||||
r#type: "search",
|
||||
placeholder: "Search Files",
|
||||
value: query,
|
||||
oninput: move |event| query.set(event.value())
|
||||
oninput: move |event| query.set(event.value()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user