[bootsier] Añade plantilla estándar propia

This commit is contained in:
Manuel Cillero 2025-11-30 10:53:49 +01:00
parent 9f79e4179a
commit ec3ad42e24
4 changed files with 55 additions and 13 deletions

View file

@ -95,7 +95,7 @@ impl Extension for SuperMenu {
})), })),
)); ));
InRegion::Named("header").add(Child::with( InRegion::Global(&DefaultRegion::Header).add(Child::with(
Container::new() Container::new()
.with_width(container::Width::FluidMax(UnitValue::RelRem(75.0))) .with_width(container::Width::FluidMax(UnitValue::RelRem(75.0)))
.add_child(navbar_menu), .add_child(navbar_menu),

View file

@ -102,6 +102,34 @@ pub mod prelude {
pub use crate::theme::*; pub use crate::theme::*;
} }
/// Plantillas que Bootsier añade.
#[derive(AutoDefault)]
pub enum BootsierTemplate {
/// Plantilla predeterminada de Bootsier.
#[default]
Standard,
}
impl Template for BootsierTemplate {
fn render(&'static self, cx: &mut Context) -> Markup {
match self {
Self::Standard => theme::Container::new()
.with_classes(ClassesOp::Add, "container-wrapper")
.with_width(theme::container::Width::FluidMax(
config::SETTINGS.bootsier.max_width,
))
.add_child(Html::with(|cx| {
html! {
(DefaultRegion::Header.render(cx))
(DefaultRegion::Content.render(cx))
(DefaultRegion::Footer.render(cx))
}
})),
}
.render(cx)
}
}
/// Implementa el tema. /// Implementa el tema.
pub struct Bootsier; pub struct Bootsier;
@ -117,6 +145,11 @@ impl Extension for Bootsier {
} }
impl Theme for Bootsier { impl Theme for Bootsier {
#[inline]
fn default_template(&self) -> TemplateRef {
&BootsierTemplate::Standard
}
fn before_render_page_body(&self, page: &mut Page) { fn before_render_page_body(&self, page: &mut Page) {
page.alter_assets(ContextOp::AddStyleSheet( page.alter_assets(ContextOp::AddStyleSheet(
StyleSheet::from("/bootsier/bs/bootstrap.min.css") StyleSheet::from("/bootsier/bs/bootstrap.min.css")
@ -127,16 +160,10 @@ impl Theme for Bootsier {
JavaScript::defer("/bootsier/js/bootstrap.bundle.min.js") JavaScript::defer("/bootsier/js/bootstrap.bundle.min.js")
.with_version(BOOTSTRAP_VERSION) .with_version(BOOTSTRAP_VERSION)
.with_weight(-90), .with_weight(-90),
)); ))
} .alter_child_in(
&DefaultRegion::Footer,
fn render_page_body(&self, page: &mut Page) -> Markup { ChildOp::AddIfEmpty(Child::with(PoweredBy::new())),
theme::Container::new() );
.with_id("container-wrapper")
.with_width(theme::container::Width::FluidMax(
config::SETTINGS.bootsier.max_width,
))
.add_child(Template::named(page.template()))
.render(page.context())
} }
} }

View file

@ -106,3 +106,9 @@ $utilities: map-merge(
), ),
) )
); );
// Region Footer
.region-footer {
padding: .75rem 0 3rem;
text-align: center;
}

View file

@ -17,13 +17,22 @@
--intro-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); --intro-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
} }
body {
overflow-x: clip;
}
.intro { .intro {
position: relative; position: relative;
min-width: 350px; min-width: 350px;
color: var(--intro-color); color: var(--intro-color);
background-color: var(--intro-bg-color); background-color: var(--intro-bg-color);
width: 100%; left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
width: 100vw;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;