From ec3ad42e24ab6864c84456bc7143f56e7b0c83eb Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Sun, 30 Nov 2025 10:53:49 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20[bootsier]=20A=C3=B1ade=20plantilla?= =?UTF-8?q?=20est=C3=A1ndar=20propia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/navbar-menus.rs | 2 +- extensions/pagetop-bootsier/src/lib.rs | 49 ++++++++++++++----- .../static/scss/_customs.scss | 6 +++ static/css/intro.css | 11 ++++- 4 files changed, 55 insertions(+), 13 deletions(-) diff --git a/examples/navbar-menus.rs b/examples/navbar-menus.rs index 341d394a..079508e9 100644 --- a/examples/navbar-menus.rs +++ b/examples/navbar-menus.rs @@ -95,7 +95,7 @@ impl Extension for SuperMenu { })), )); - InRegion::Named("header").add(Child::with( + InRegion::Global(&DefaultRegion::Header).add(Child::with( Container::new() .with_width(container::Width::FluidMax(UnitValue::RelRem(75.0))) .add_child(navbar_menu), diff --git a/extensions/pagetop-bootsier/src/lib.rs b/extensions/pagetop-bootsier/src/lib.rs index fb9b7206..5c88959a 100644 --- a/extensions/pagetop-bootsier/src/lib.rs +++ b/extensions/pagetop-bootsier/src/lib.rs @@ -102,6 +102,34 @@ pub mod prelude { 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. pub struct Bootsier; @@ -117,6 +145,11 @@ impl Extension for Bootsier { } impl Theme for Bootsier { + #[inline] + fn default_template(&self) -> TemplateRef { + &BootsierTemplate::Standard + } + fn before_render_page_body(&self, page: &mut Page) { page.alter_assets(ContextOp::AddStyleSheet( StyleSheet::from("/bootsier/bs/bootstrap.min.css") @@ -127,16 +160,10 @@ impl Theme for Bootsier { JavaScript::defer("/bootsier/js/bootstrap.bundle.min.js") .with_version(BOOTSTRAP_VERSION) .with_weight(-90), - )); - } - - fn render_page_body(&self, page: &mut Page) -> Markup { - 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()) + )) + .alter_child_in( + &DefaultRegion::Footer, + ChildOp::AddIfEmpty(Child::with(PoweredBy::new())), + ); } } diff --git a/extensions/pagetop-bootsier/static/scss/_customs.scss b/extensions/pagetop-bootsier/static/scss/_customs.scss index 988d7055..45e41001 100644 --- a/extensions/pagetop-bootsier/static/scss/_customs.scss +++ b/extensions/pagetop-bootsier/static/scss/_customs.scss @@ -106,3 +106,9 @@ $utilities: map-merge( ), ) ); + +// Region Footer +.region-footer { + padding: .75rem 0 3rem; + text-align: center; +} diff --git a/static/css/intro.css b/static/css/intro.css index 9c47c5c4..e3de4153 100644 --- a/static/css/intro.css +++ b/static/css/intro.css @@ -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); } +body { + overflow-x: clip; +} + .intro { position: relative; min-width: 350px; color: var(--intro-color); background-color: var(--intro-bg-color); - width: 100%; + left: 50%; + right: 50%; + margin-left: -50vw; + margin-right: -50vw; + width: 100vw; + display: flex; flex-direction: column; justify-content: center;