WIP components
Some checks failed
Build Crate / build (push) Failing after 1m2s

This commit is contained in:
2024-08-29 21:23:39 -04:00
parent d25fb283cc
commit d523373b8e
3 changed files with 40 additions and 13 deletions

View File

@@ -0,0 +1,36 @@
use perseus::prelude::*;
use sycamore::prelude::*;
use web_sys::Event;
cfg_if::cfg_if! {
if #[cfg(client)] {
use crate::{
state_enums::OpenState,
};
}
}
#[derive(Prop, Debug, Clone)]
pub struct ErrorBlockProps {
error: RcSignal<String>,
}
#[component]
pub fn ErrorBlock<G: Html>(cx: Scope, props: ErrorBlockProps) -> View<G> {
let is_empty = create_selector(cx, || props.error.get().is_empty());
view! { cx,
(match *is_empty.get() {
true => { view!{cx,
div (role="alert") {
div (class="bg-red-500 text-white font-bold rounded-t px-4 py-2") {
"Error"
}
div (class="border border-t-0 border-red-400 rounded-b bg-red-100 px-4 py-3 text-red-700"){
p {(*props.error.get())}
}
}
}},
false => {view!{cx,}},
})
}
}

View File

@@ -1,2 +1,3 @@
pub mod error_block;
mod header;
pub mod layout;