pagetop/src/base/theme/basic.rs
Manuel Cillero c3feff9efd 🚚 Renombra ContextOp a AssetsOp
El nombre anterior era ambiguo (podría referirse a cualquier operación
del contexto); `AssetsOp` describe exactamente lo que hace: operar sobre
los recursos del documento.
2026-03-21 11:12:46 +01:00

30 lines
884 B
Rust

/// Es el tema básico que incluye PageTop por defecto.
use crate::prelude::*;
/// Tema básico por defecto que extiende el funcionamiento predeterminado de [`Theme`].
pub struct Basic;
impl Extension for Basic {
fn theme(&self) -> Option<ThemeRef> {
Some(&Self)
}
}
impl Theme for Basic {
fn before_render_page_body(&self, page: &mut Page) {
page.alter_assets(AssetsOp::AddStyleSheet(
StyleSheet::from("/css/normalize.css")
.with_version("8.0.1")
.with_weight(-99),
))
.alter_assets(AssetsOp::AddStyleSheet(
StyleSheet::from("/css/basic.css")
.with_version(PAGETOP_VERSION)
.with_weight(-99),
))
.alter_child_in(
&DefaultRegion::Footer,
ChildOp::AddIfEmpty(Child::with(PoweredBy::new())),
);
}
}