🚧 Simplify basic components
This commit is contained in:
parent
c65ac74a6f
commit
496c9d375b
5 changed files with 14 additions and 32 deletions
|
|
@ -160,6 +160,12 @@ pub use html::Html;
|
|||
mod fluent;
|
||||
pub use fluent::Fluent;
|
||||
|
||||
mod error403;
|
||||
pub use error403::Error403;
|
||||
|
||||
mod error404;
|
||||
pub use error404::Error404;
|
||||
|
||||
mod wrapper;
|
||||
pub use wrapper::{Wrapper, WrapperType};
|
||||
|
||||
|
|
@ -189,12 +195,6 @@ pub use branding::Branding;
|
|||
mod powered_by;
|
||||
pub use powered_by::{PoweredBy, PoweredByLogo};
|
||||
|
||||
mod error403;
|
||||
pub use error403::Error403;
|
||||
|
||||
mod error404;
|
||||
pub use error404::Error404;
|
||||
|
||||
pub mod menu;
|
||||
pub use menu::Menu;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use crate::core::component::{ComponentTrait, Context};
|
||||
use crate::html::{html, PrepareMarkup};
|
||||
use crate::prelude::*;
|
||||
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Error403;
|
||||
|
||||
impl ComponentTrait for Error403 {
|
||||
fn new() -> Self {
|
||||
Error403
|
||||
Error403::default()
|
||||
}
|
||||
|
||||
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use crate::core::component::{ComponentTrait, Context};
|
||||
use crate::html::{html, PrepareMarkup};
|
||||
use crate::prelude::*;
|
||||
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Error404;
|
||||
|
||||
impl ComponentTrait for Error404 {
|
||||
fn new() -> Self {
|
||||
Error404
|
||||
Error404::default()
|
||||
}
|
||||
|
||||
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ impl ComponentTrait for Fluent {
|
|||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
PrepareMarkup::With(self.l10n().escaped(cx.langid()))
|
||||
PrepareMarkup::With(self.0.escaped(cx.langid()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -18,17 +18,8 @@ impl Fluent {
|
|||
Fluent(l10n)
|
||||
}
|
||||
|
||||
// Fluent BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_l10n(&mut self, l10n: L10n) -> &mut Self {
|
||||
self.0 = l10n;
|
||||
self
|
||||
}
|
||||
|
||||
// Fluent GETTERS.
|
||||
|
||||
pub fn l10n(&self) -> &L10n {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ impl ComponentTrait for Html {
|
|||
}
|
||||
|
||||
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
||||
PrepareMarkup::With(html! { (self.html()) })
|
||||
PrepareMarkup::With(html! { (self.0) })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -18,17 +18,8 @@ impl Html {
|
|||
Html(html)
|
||||
}
|
||||
|
||||
// Html BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_html(&mut self, html: Markup) -> &mut Self {
|
||||
self.0 = html;
|
||||
self
|
||||
}
|
||||
|
||||
// Html GETTERS.
|
||||
|
||||
pub fn html(&self) -> &Markup {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue