🏗️ Use actions to decide component rendering
This commit is contained in:
parent
45cb063e52
commit
7d4cf642ff
27 changed files with 125 additions and 304 deletions
|
|
@ -13,9 +13,8 @@ pub enum PoweredByLogo {
|
|||
#[rustfmt::skip]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct PoweredBy {
|
||||
renderable: Renderable,
|
||||
copyright : Option<String>,
|
||||
logo : PoweredByLogo,
|
||||
copyright: Option<String>,
|
||||
logo : PoweredByLogo,
|
||||
}
|
||||
|
||||
impl ComponentTrait for PoweredBy {
|
||||
|
|
@ -28,10 +27,6 @@ impl ComponentTrait for PoweredBy {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let poweredby_pagetop = L10n::l("poweredby_pagetop")
|
||||
.with_arg(
|
||||
|
|
@ -62,12 +57,6 @@ impl ComponentTrait for PoweredBy {
|
|||
impl PoweredBy {
|
||||
// PoweredBy BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_copyright(&mut self, copyright: Option<impl Into<String>>) -> &mut Self {
|
||||
self.copyright = copyright.map(|c| c.into());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue