From 3d2e75057757e595cc5ff29092579e3dce763f4f Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Mon, 13 Nov 2023 17:23:58 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20General=20components=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagetop-admin/src/lib.rs | 4 +- pagetop-bootsier/src/lib.rs | 6 +- pagetop-bootsier/static/css/styles.css | 8 +- pagetop-bulmix/src/lib.rs | 48 +- pagetop-bulmix/static/css/styles.css | 11 + pagetop-homedemo/src/lib.rs | 10 +- pagetop-homedemo/static/css/styles.css | 4 +- pagetop-node/src/lib.rs | 2 +- pagetop/src/base/component.rs | 9 +- pagetop/src/base/component/block.rs | 33 +- pagetop/src/base/component/branding.rs | 20 +- .../base/component/{anchor.rs => button.rs} | 129 +- pagetop/src/base/component/flex/container.rs | 56 +- pagetop/src/base/component/flex/item.rs | 64 +- pagetop/src/base/component/form/button.rs | 26 +- pagetop/src/base/component/heading.rs | 27 +- pagetop/src/base/component/icon.rs | 47 +- pagetop/src/base/component/image.rs | 14 +- pagetop/src/base/component/paragraph.rs | 38 +- pagetop/src/base/component/wrapper.rs | 25 +- pagetop/src/core/component/definition.rs | 6 + pagetop/static/base/css/buttons.css | 1211 +++++++++++++++++ pagetop/static/base/css/inception.css | 15 +- pagetop/static/base/css/looks.css | 2 +- pagetop/static/base/css/root.css | 46 +- 25 files changed, 1557 insertions(+), 304 deletions(-) create mode 100644 pagetop-bulmix/static/css/styles.css rename pagetop/src/base/component/{anchor.rs => button.rs} (61%) create mode 100644 pagetop/static/base/css/buttons.css diff --git a/pagetop-admin/src/lib.rs b/pagetop-admin/src/lib.rs index bf7f5ca0..db70f468 100644 --- a/pagetop-admin/src/lib.rs +++ b/pagetop-admin/src/lib.rs @@ -19,8 +19,8 @@ impl ModuleTrait for Admin { fn actions(&self) -> Vec { actions![ - action::page::BeforePrepareBody::with(before_prepare_body), - action::component::BeforePrepareComponent::::with(before_prepare_menu) + action::page::BeforePrepareBody::new(before_prepare_body), + action::component::BeforePrepareComponent::::new(before_prepare_menu) .filter_by_referer_id("admin-menu-test"), ] } diff --git a/pagetop-bootsier/src/lib.rs b/pagetop-bootsier/src/lib.rs index 40e837ad..543bca46 100644 --- a/pagetop-bootsier/src/lib.rs +++ b/pagetop-bootsier/src/lib.rs @@ -124,16 +124,16 @@ impl ThemeTrait for Bootsier { } _ => {} }; - match a.anchor_type() { + match a.button_type() { ButtonType::Link => { a.alter_classes( - ClassesOp::Replace(a.anchor_type().to_string()), + ClassesOp::Replace(a.button_type().to_string()), "btn btn-link", ); } ButtonType::Primary => { a.alter_classes( - ClassesOp::Replace(a.anchor_type().to_string()), + ClassesOp::Replace(a.button_type().to_string()), "btn btn-primary", ); } diff --git a/pagetop-bootsier/static/css/styles.css b/pagetop-bootsier/static/css/styles.css index a26bdd57..9f458863 100644 --- a/pagetop-bootsier/static/css/styles.css +++ b/pagetop-bootsier/static/css/styles.css @@ -3,5 +3,11 @@ /* Heading component */ .pt-heading__subtitle { - margin-top: calc(-1 * var(--pt-gap-0-5)); + margin-top: calc(-1 * var(--pt-gap-0-35)); +} + +/* Button component */ + +.btn-link { + text-decoration: none; } diff --git a/pagetop-bulmix/src/lib.rs b/pagetop-bulmix/src/lib.rs index 272f83b2..ba50dd68 100644 --- a/pagetop-bulmix/src/lib.rs +++ b/pagetop-bulmix/src/lib.rs @@ -24,7 +24,10 @@ impl ThemeTrait for Bulmix { .with_version("0.9.4") .with_weight(-99), )) - .alter_context(ContextOp::AddBaseAssets); + .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) { @@ -50,8 +53,8 @@ impl ThemeTrait for Bulmix { _ => {} }; } - COMPONENT_BASE_ANCHOR => { - let a = component_as_mut::(component); + COMPONENT_BASE_BUTTON => { + let a = component_as_mut::