Skip to content

Commit ec845db

Browse files
committed
breadcrumb dropdown styling
1 parent f367f18 commit ec845db

File tree

5 files changed

+83
-23
lines changed

5 files changed

+83
-23
lines changed

pgml-dashboard/src/components/breadcrumbs/breadcrumbs.scss

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,16 @@
2828
}
2929
}
3030

31-
.vr {
32-
opacity: 1;
33-
color: #{$gray-600};
34-
width: 2px;
31+
> *:not(:last-child) {
32+
&::after {
33+
content: '/';
34+
margin: 0 2px;
35+
color: #{$gray-600};
36+
}
37+
}
38+
39+
li {
40+
display: flex;
41+
align-items: center;
3542
}
3643
}

pgml-dashboard/src/components/breadcrumbs/template.html

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,19 @@
1212

1313
<nav>
1414
<nav aria-label="breadcrumb z-1">
15-
<ol class="breadcrumb">
16-
<!-- <li class="breadcrumb-item body-regular-text <% if path.is_empty() {%>active<% } %>">
17-
<a class="d-flex gap-2 align-items-center" href="<%- home_uri %>">
18-
<span class="icon-owl icomoon"></span>
19-
Home
20-
</a>
21-
</li> -->
22-
15+
<ol class="breadcrumb gap-3">
2316
<% if !organizations.is_empty() {%>
2417
<li>
25-
<%+ Dropdown::nav(organizations) %>
18+
<%+ Dropdown::nav(organizations).inline_style() %>
2619
</li>
2720
<% } %>
2821

2922
<% if !databases.is_empty() {%>
3023
<li>
31-
<%+ Dropdown::nav(databases) %>
24+
<%+ Dropdown::nav(databases).inline_style() %>
3225
</li>
3326
<% } %>
3427

35-
<% if !path.is_empty() {%>
36-
<div class="vr my-1 mx-2"></div>
37-
<% } %>
38-
3928
<% for link in path {
4029
let active = if link.active {
4130
"active"
@@ -54,9 +43,6 @@
5443
<a href="<%= link.href %>">
5544
<%= link.name %>
5645
</a>
57-
<% if active.is_empty() { %>
58-
<div class="vr my-1 ms-2"></div>
59-
<% } %>
6046
</li>
6147
<% } %>
6248
</ol>

pgml-dashboard/src/components/dropdown/dropdown.scss

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,51 @@
9292
}
9393
}
9494

95+
.btn-dropdown-inline {
96+
color: #{$slate-shade-100};
97+
display: flex;
98+
justify-content: space-between;
99+
font-weight: $font-weight-normal;
100+
101+
--bs-btn-hover-color: #{$slate-tint-400};
102+
--bs-btn-active-color: #{$slate-tint-700};
103+
--bs-btn-active-border-color: transparent;
104+
105+
106+
107+
&:after {
108+
content: None;
109+
}
110+
111+
&.show {
112+
.material-symbols-outlined {
113+
transform: rotate(-180deg);
114+
}
115+
}
116+
117+
.btn-dropdown-text {
118+
overflow: hidden;
119+
text-overflow: ellipsis;
120+
text-align: left;
121+
}
122+
123+
.menu-item {
124+
a, div {
125+
padding: 8px 12px;
126+
overflow: hidden;
127+
text-overflow: ellipsis;
128+
}
129+
130+
&:hover {
131+
cursor: pointer;
132+
}
133+
134+
&:after {
135+
content: None;
136+
}
137+
}
138+
}
139+
95140
@mixin dropdown-menu($primary-color: null) {
96141
padding: 20px 0px 20px 0px;
97142
overflow-y: auto;

pgml-dashboard/src/components/dropdown/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ pub struct Dropdown {
8585

8686
/// If the dropdown should be shown
8787
show: String,
88+
89+
/// alt styling for button
90+
inline_style: bool,
8891
}
8992

9093
impl Dropdown {
@@ -95,6 +98,7 @@ impl Dropdown {
9598
offset: "0, 10".to_owned(),
9699
offset_collapsed: "68, -44".to_owned(),
97100
menu_position: "".to_owned(),
101+
inline_style: false,
98102
..Default::default()
99103
}
100104
}
@@ -192,6 +196,11 @@ impl Dropdown {
192196
self.show = "show".into();
193197
self
194198
}
199+
200+
pub fn inline_style(mut self) -> Self {
201+
self.inline_style = true;
202+
self
203+
}
195204
}
196205

197206
component!(Dropdown);

pgml-dashboard/src/components/dropdown/template.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11

22
<% use crate::components::dropdown::DropdownValue; %>
3+
<%
4+
let btn_style = if inline_style {
5+
"btn-dropdown-inline"
6+
} else {
7+
"btn-dropdown"
8+
};
9+
10+
let padding = if inline_style {
11+
"p-0"
12+
} else {
13+
""
14+
};
15+
%>
316

417
<!-- Dropdown component -->
5-
<div class="dropdown <% if expandable { %>expandable<% } %>">
18+
<div class="dropdown <%- padding %> <% if expandable { %>expandable<% } %>">
619
<% if let DropdownValue::Icon(icon) = value { %>
720
<a
821
class="top-nav-controls dropdown-toggle"
@@ -15,7 +28,7 @@
1528
</a>
1629
<% } else if let DropdownValue::Text(text) = value { %>
1730
<button
18-
class="horizontal-hide btn btn-dropdown dropdown-toggle expanded <% if collapsable { %>leftnav-collapse-affect<% } %>"
31+
class="horizontal-hide btn <%- btn_style %> dropdown-toggle expanded <% if collapsable { %>leftnav-collapse-affect<% } %>"
1932
role="button"
2033
data-bs-toggle="dropdown"
2134
data-bs-offset="<%= offset %>"

0 commit comments

Comments
 (0)