diff --git a/pgml-dashboard/src/components/lists/item/mod.rs b/pgml-dashboard/src/components/lists/item/mod.rs index 8a0ff1645..0ae5d1b73 100644 --- a/pgml-dashboard/src/components/lists/item/mod.rs +++ b/pgml-dashboard/src/components/lists/item/mod.rs @@ -1,16 +1,41 @@ use pgml_components::component; use sailfish::TemplateOnce; +use std::fmt; + +#[derive(PartialEq, Eq, Default, Clone)] +pub enum Color { + #[default] + Green, + Blue, + Orange, + Pink, + Purple, +} + +impl fmt::Display for Color { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Color::Green => write!(f, "green"), + Color::Blue => write!(f, "blue"), + Color::Orange => write!(f, "orange"), + Color::Pink => write!(f, "pink"), + Color::Purple => write!(f, "purple"), + } + } +} #[derive(TemplateOnce, Default)] #[template(path = "lists/item/template.html")] pub struct Item { value: String, + color: Color, } impl Item { pub fn new() -> Item { Item { value: String::from("Your list item"), + color: Color::Green, } } @@ -18,6 +43,11 @@ impl Item { self.value = value.into(); self } + + pub fn color(mut self, color: Color) -> Item { + self.color = color; + self + } } component!(Item); diff --git a/pgml-dashboard/src/components/lists/item/template.html b/pgml-dashboard/src/components/lists/item/template.html index 7df3b5ec6..d4c85e98d 100644 --- a/pgml-dashboard/src/components/lists/item/template.html +++ b/pgml-dashboard/src/components/lists/item/template.html @@ -1,4 +1,6 @@
- Checkmark + + check + <%- value %>
diff --git a/pgml-dashboard/src/components/navigation/navbar/marketing/template.html b/pgml-dashboard/src/components/navigation/navbar/marketing/template.html index ff3715baf..7d4313763 100644 --- a/pgml-dashboard/src/components/navigation/navbar/marketing/template.html +++ b/pgml-dashboard/src/components/navigation/navbar/marketing/template.html @@ -13,14 +13,14 @@