Add page for displaying error

This commit is contained in:
2024-10-21 22:57:27 -04:00
parent 88e2a229a4
commit f1e177c7b0
4 changed files with 45 additions and 1 deletions

24
src/pages/error.rs Normal file
View File

@ -0,0 +1,24 @@
use leptos::*;
use leptos_icons::*;
use std::fmt::Display;
#[component]
pub fn ServerError<E: Display + 'static>(
#[prop(optional, into, default="An Error Occurred".into())]
title: TextProp,
#[prop(optional, into)]
message: TextProp,
#[prop(optional, into)]
error: Option<ServerFnError<E>>,
) -> impl IntoView {
view! {
<div class="error-container home-component">
<div class="error-header">
<Icon icon=icondata::BiErrorSolid />
<h1>{title}</h1>
</div>
<p>{message}</p>
<p>{error.map(|error| format!("{}", error))}</p>
</div>
}
}