From 9afe75bc8fd961f050ee31fc9e86e37eb6f8ffb6 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Tue, 18 Feb 2025 19:08:50 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/asset.rs | 17 ++++++++------ src/ui/components/mod.rs | 1 + src/ui/components/modal.rs | 45 ++++++++++++++++++++------------------ src/ui/components/shell.rs | 11 ++++++---- src/ui/primitives/grid.rs | 34 +++++++++++++++------------- 5 files changed, 61 insertions(+), 47 deletions(-) diff --git a/src/asset.rs b/src/asset.rs index 0239eda..2a929f9 100644 --- a/src/asset.rs +++ b/src/asset.rs @@ -52,12 +52,15 @@ pub trait AssetRoutes { impl AssetRoutes for rocket::Rocket { fn mount_assets(self) -> Self { - self.mount("/", routes![ - crate::asset::htmx_script_route, - crate::asset::flowbite_css, - crate::asset::flowbite_js, - crate::asset::material_css, - crate::asset::material_font - ]) + self.mount( + "/", + routes![ + crate::asset::htmx_script_route, + crate::asset::flowbite_css, + crate::asset::flowbite_js, + crate::asset::material_css, + crate::asset::material_font + ], + ) } } diff --git a/src/ui/components/mod.rs b/src/ui/components/mod.rs index d3e5219..c207465 100644 --- a/src/ui/components/mod.rs +++ b/src/ui/components/mod.rs @@ -31,6 +31,7 @@ pub mod prelude { Alignment, BottomNavigation, BottomNavigationTile, Classic, ClassicWidget, FetchToast, NavBar, Position, Shell, Toast, }; + pub use super::timeline::{ActivityLog, ActivityLogElement, Timeline, TimelineElement}; pub use super::{ Accordion, Alert, Banner, Breadcrumb, Card, Carousel, CarouselMode, ColoredAlert, ColoredSpinner, CopyText, FetchAlert, FnKey, HelpIcon, HorizontalLine, IconStepper, diff --git a/src/ui/components/modal.rs b/src/ui/components/modal.rs index 9a6fbe0..ebb4985 100644 --- a/src/ui/components/modal.rs +++ b/src/ui/components/modal.rs @@ -26,29 +26,32 @@ pub fn Modal ) -> (String, PreEscaped) { let id = uuid::Uuid::new_v4().to_string(); - (format!("modal-{id}"), html! { - div id=(format!("modal-{id}")) tabindex="-1" aria-hidden="true" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full" { - div class="relative p-4 w-full max-w-2xl max-h-full" { + ( + format!("modal-{id}"), + html! { + div id=(format!("modal-{id}")) tabindex="-1" aria-hidden="true" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full" { + div class="relative p-4 w-full max-w-2xl max-h-full" { - div class="relative bg-white rounded-lg shadow dark:bg-gray-700" { - div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600" { - h3 class="text-xl font-semibold text-gray-900 dark:text-white" { (title) } - button type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide="default-modal" { - svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14" { - path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" {}; - }; - span class="sr-only" { "Close modal" }; - } - }; + div class="relative bg-white rounded-lg shadow dark:bg-gray-700" { + div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600" { + h3 class="text-xl font-semibold text-gray-900 dark:text-white" { (title) } + button type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide="default-modal" { + svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14" { + path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" {}; + }; + span class="sr-only" { "Close modal" }; + } + }; - div class="p-4 md:p-5 space-y-4" { - (body) - }; + div class="p-4 md:p-5 space-y-4" { + (body) + }; - div class="flex items-center p-4 md:p-5 border-t border-gray-200 rounded-b dark:border-gray-600" { - (footer(format!("modal-{id}"))) + div class="flex items-center p-4 md:p-5 border-t border-gray-200 rounded-b dark:border-gray-600" { + (footer(format!("modal-{id}"))) + }; }; - }; - }}; - }) + }}; + }, + ) } diff --git a/src/ui/components/shell.rs b/src/ui/components/shell.rs index ed5fd23..85e3b79 100644 --- a/src/ui/components/shell.rs +++ b/src/ui/components/shell.rs @@ -278,10 +278,13 @@ pub fn BottomNavigationTile( ) -> ClassicWidget { Classic( "inline-flex flex-col items-center justify-center px-5 hover:bg-gray-50 dark:hover:bg-gray-800 group", - Link(reference, html! { - (icon.map(|x| x.render()).unwrap_or_default()); - span class="text-sm text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500" { (text) }; - }), + Link( + reference, + html! { + (icon.map(|x| x.render()).unwrap_or_default()); + span class="text-sm text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500" { (text) }; + }, + ), ) } diff --git a/src/ui/primitives/grid.rs b/src/ui/primitives/grid.rs index cd1e345..31d46c1 100644 --- a/src/ui/primitives/grid.rs +++ b/src/ui/primitives/grid.rs @@ -274,21 +274,25 @@ impl GridElement { } pub fn span(mut self, value: GridElementValue) -> Self { - self.1.push(format!("{}-span-{}", self.2, match value { - GridElementValue::_1 => "1", - GridElementValue::_2 => "2", - GridElementValue::_3 => "3", - GridElementValue::_4 => "4", - GridElementValue::_5 => "5", - GridElementValue::_6 => "6", - GridElementValue::_7 => "7", - GridElementValue::_8 => "8", - GridElementValue::_9 => "9", - GridElementValue::_10 => "10", - GridElementValue::_11 => "11", - GridElementValue::_12 => "12", - GridElementValue::Auto => "full", - })); + self.1.push(format!( + "{}-span-{}", + self.2, + match value { + GridElementValue::_1 => "1", + GridElementValue::_2 => "2", + GridElementValue::_3 => "3", + GridElementValue::_4 => "4", + GridElementValue::_5 => "5", + GridElementValue::_6 => "6", + GridElementValue::_7 => "7", + GridElementValue::_8 => "8", + GridElementValue::_9 => "9", + GridElementValue::_10 => "10", + GridElementValue::_11 => "11", + GridElementValue::_12 => "12", + GridElementValue::Auto => "full", + } + )); self }