Add generic Error component
This commit is contained in:
parent
39dd8099cd
commit
833393cb3a
@ -10,6 +10,27 @@ pub fn ServerError<E: Display + 'static>(
|
|||||||
message: TextProp,
|
message: TextProp,
|
||||||
#[prop(optional, into)]
|
#[prop(optional, into)]
|
||||||
error: Option<ServerFnError<E>>,
|
error: Option<ServerFnError<E>>,
|
||||||
|
) -> impl IntoView {
|
||||||
|
view!{
|
||||||
|
<div class="error-container">
|
||||||
|
<div class="error-header">
|
||||||
|
<Icon icon=icondata::BiErrorSolid />
|
||||||
|
<h1>{title}</h1>
|
||||||
|
</div>
|
||||||
|
<p>{message}</p>
|
||||||
|
<p>{error.map(|error| format!("{}", error))}</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Error<E: Display + 'static>(
|
||||||
|
#[prop(optional, into, default="An Error Occurred".into())]
|
||||||
|
title: TextProp,
|
||||||
|
#[prop(optional, into)]
|
||||||
|
message: TextProp,
|
||||||
|
#[prop(optional, into)]
|
||||||
|
error: Option<E>,
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<div class="error-container">
|
<div class="error-container">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user