use pagetop::prelude::*; static_files!(bulmix); #[derive(AssignHandle)] pub struct Bulmix; impl PackageTrait for Bulmix { fn theme(&self) -> Option { Some(&Bulmix) } fn configure_service(&self, scfg: &mut service::web::ServiceConfig) { service_for_static_files!(scfg, bulmix => "/bulmix"); } } impl ThemeTrait for Bulmix { fn after_prepare_body(&self, page: &mut Page) { page.alter_favicon(Some(Favicon::new().with_icon("/base/favicon.ico"))) .alter_context(ContextOp::AddStyleSheet( StyleSheet::at("/bulmix/css/bulma.min.css") .with_version("0.9.4") .with_weight(-99), )) .alter_context(ContextOp::AddBaseAssets) .alter_context(ContextOp::AddStyleSheet( StyleSheet::at("/bulmix/css/styles.css").with_version("0.0.1"), )); } fn before_prepare_component(&self, component: &mut dyn ComponentTrait, _cx: &mut Context) { match component.handle() { h if Icon::matches_handle(h) => { if let Some(i) = component_as_mut::(component) { match i.font_size() { FontSize::ExtraLarge => { i.replace_classes(i.font_size().to_string(), "is-size-1"); } FontSize::XxLarge => { i.replace_classes(i.font_size().to_string(), "is-size-2"); } FontSize::XLarge => { i.replace_classes(i.font_size().to_string(), "is-size-3"); } FontSize::Large => { i.replace_classes(i.font_size().to_string(), "is-size-4"); } FontSize::Medium => { i.replace_classes(i.font_size().to_string(), "is-size-5"); } _ => {} }; } } h if Button::matches_handle(h) => { if let Some(b) = component_as_mut::