Skip to content

Commit 75b0b7e

Browse files
add list item to take color, small refactors (#1126)
1 parent ae57bac commit 75b0b7e

File tree

5 files changed

+42
-24
lines changed

5 files changed

+42
-24
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,53 @@
11
use pgml_components::component;
22
use sailfish::TemplateOnce;
3+
use std::fmt;
4+
5+
#[derive(PartialEq, Eq, Default, Clone)]
6+
pub enum Color {
7+
#[default]
8+
Green,
9+
Blue,
10+
Orange,
11+
Pink,
12+
Purple,
13+
}
14+
15+
impl fmt::Display for Color {
16+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17+
match self {
18+
Color::Green => write!(f, "green"),
19+
Color::Blue => write!(f, "blue"),
20+
Color::Orange => write!(f, "orange"),
21+
Color::Pink => write!(f, "pink"),
22+
Color::Purple => write!(f, "purple"),
23+
}
24+
}
25+
}
326

427
#[derive(TemplateOnce, Default)]
528
#[template(path = "lists/item/template.html")]
629
pub struct Item {
730
value: String,
31+
color: Color,
832
}
933

1034
impl Item {
1135
pub fn new() -> Item {
1236
Item {
1337
value: String::from("Your list item"),
38+
color: Color::Green,
1439
}
1540
}
1641

1742
pub fn value(mut self, value: &str) -> Item {
1843
self.value = value.into();
1944
self
2045
}
46+
47+
pub fn color(mut self, color: Color) -> Item {
48+
self.color = color;
49+
self
50+
}
2151
}
2252

2353
component!(Item);
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<div class="list-group-item d-flex align-items-center gap-2">
2-
<img loading="lazy" src="/dashboard/static/images/icons/checkmark.svg" width="15" height="11" alt="Checkmark">
2+
<span class="material-symbols-outlined text-gradient-<%- color.to_string() %> align-self-start">
3+
check
4+
</span>
35
<%- value %>
46
</div>

pgml-dashboard/src/components/navigation/navbar/marketing/template.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
<div class="collapse navbar-collapse" id="navbarSupportedContent">
1515
<ul class="navbar-nav flex-grow-1 gap-4 me-auto mb-4 mb-lg-0">
16+
<% if !standalone_dashboard { %>
17+
<li class="nav-item d-flex align-items-center">
18+
<a class="nav-link p-0" href="/plans">Pricing</a>
19+
</li>
20+
<% } %>
1621
<li class="nav-item d-flex align-items-center">
1722
<a class="nav-link p-0" href="/docs/guides/">Docs</a>
1823
</li>
19-
<% if !standalone_dashboard { %>
20-
<!-- <li class="nav-item d-flex align-items-center">
21-
<a class="nav-link p-0" href="/plan_comparison">Pricing</a>
22-
</li> -->
23-
<% } %>
2424
<li class="nav-item d-flex align-items-center">
2525
<a class="nav-link p-0" href="/blog/speeding-up-vector-recall-by-5x-with-hnsw">Blog</a>
2626
</li>

pgml-dashboard/static/css/scss/base/_base.scss

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ article {
7474
background-color: #{$bg-white} !important;
7575
}
7676

77-
// Our flagship gradient.
78-
.party-time {
79-
background: $gradient-text;
80-
-webkit-background-clip: text;
81-
-webkit-text-fill-color: transparent;
82-
background-clip: text;
83-
text-fill-color: transparent;
84-
}
85-
8677
// Remove padding from large screens.
8778
@include media-breakpoint-up(lg) {
8879
body {
@@ -116,14 +107,6 @@ article {
116107
background: #{$purple};
117108
}
118109

119-
.syntax-highlight {
120-
background: $gradient-blue;
121-
-webkit-background-clip: text;
122-
-webkit-text-fill-color: transparent;
123-
background-clip: text;
124-
text-fill-color: transparent;
125-
}
126-
127110
.noselect {
128111
-webkit-touch-callout: none; /* iOS Safari */
129112
-webkit-user-select: none; /* Safari */

pgml-dashboard/static/css/scss/base/_typography.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ h6, .h6 {
9090
background-clip: text;
9191
text-fill-color: transparent;
9292
}
93-
.text-gradient-blue {
93+
.text-gradient-blue, .syntax-highlight {
9494
@include text-gradient($gradient-blue);
9595
}
9696
.text-gradient-green {
@@ -105,6 +105,9 @@ h6, .h6 {
105105
.text-gradient-purple {
106106
@include text-gradient($gradient-purple);
107107
}
108+
.text-gradient-party, .party-time {
109+
@include text-gradient($gradient-text);
110+
}
108111

109112

110113
.marketing-body-large {

0 commit comments

Comments
 (0)