@@ -11,29 +11,10 @@
-
-
-
-
-
-
+
+ <%+ Dropdown::new(dropdown_nav.links) %>
- <%+ LeftNavMenu { nav: upper_nav } %>
+ <%+ LeftNavMenu { nav: upper_nav } %>
<%+ LeftNavMenu { nav: lower_nav} %>
diff --git a/pgml-dashboard/src/components/mod.rs b/pgml-dashboard/src/components/mod.rs
index d8c65199b..94f9174b1 100644
--- a/pgml-dashboard/src/components/mod.rs
+++ b/pgml-dashboard/src/components/mod.rs
@@ -13,6 +13,10 @@ pub use breadcrumbs::Breadcrumbs;
pub mod confirm_modal;
pub use confirm_modal::ConfirmModal;
+// src/components/dropdown
+pub mod dropdown;
+pub use dropdown::Dropdown;
+
// src/components/github_icon
pub mod github_icon;
pub use github_icon::GithubIcon;
diff --git a/pgml-dashboard/static/css/modules.scss b/pgml-dashboard/static/css/modules.scss
index c038c5029..e457a99bd 100644
--- a/pgml-dashboard/static/css/modules.scss
+++ b/pgml-dashboard/static/css/modules.scss
@@ -1,6 +1,7 @@
// This file is automatically generated.
// There is no need to edit it manually.
+@import "../../src/components/dropdown/dropdown.scss";
@import "../../src/components/left_nav_menu/left_nav_menu.scss";
@import "../../src/components/left_nav_web_app/left_nav_web_app.scss";
@import "../../src/components/modal/modal.scss";
diff --git a/pgml-dashboard/static/css/scss/components/_buttons.scss b/pgml-dashboard/static/css/scss/components/_buttons.scss
index 0dd97c365..04670a96c 100644
--- a/pgml-dashboard/static/css/scss/components/_buttons.scss
+++ b/pgml-dashboard/static/css/scss/components/_buttons.scss
@@ -244,57 +244,6 @@
font-weight: $font-weight-medium;
}
-.btn-dropdown {
- @extend .btn;
- border-radius: $border-radius;
- background: #{$gray-700};
- color: #{$gray-100};
- display: flex;
- justify-content: space-between;
- font-weight: $font-weight-normal;
-
- --bs-btn-border-color: transparent;
- --bs-btn-border-width: 1px;
- --bs-btn-hover-border-color: #{$neon-shade-100};
- --bs-btn-active-border-color: #{$neon-shade-100};
- --bs-btn-active-bg: #{$gray-700};
- --bs-btn-active-color: #{$gray-100};
- --bs-btn-hover-color: #{$gray-100};
-
- .material-symbols-outlined {
- color: #{$neon-shade-100};
- }
-
- &:after {
- content: None;
- }
-
- &.show {
- .material-symbols-outlined {
- transform: rotate(-180deg);
- }
- }
-
- .collapase {
- width: 100%;
- }
-}
-
-.btn-dropdown-menu-item {
- @extend .menu-item;
- a {
- padding: 8px 12px;
- }
-
- &:hover {
- cursor: pointer;
- }
-
- &:after {
- content: None;
- }
-}
-
.btn-left-nav-toggle {
@extend .btn;
--bs-btn-padding-x: 0px;
diff --git a/pgml-dashboard/static/css/scss/components/_dropdown.scss b/pgml-dashboard/static/css/scss/components/_dropdown.scss
index a53d12a2c..8ee69cc26 100644
--- a/pgml-dashboard/static/css/scss/components/_dropdown.scss
+++ b/pgml-dashboard/static/css/scss/components/_dropdown.scss
@@ -10,6 +10,7 @@
.dropdown-menu {
@include dropdown-menu($gray-600);
max-height: $dropdown-menu-height;
+ overflow: hidden;
}
.sub-menu-dropdown {
diff --git a/pgml-dashboard/static/css/scss/components/_navs.scss b/pgml-dashboard/static/css/scss/components/_navs.scss
index 13f8d1dac..3864995a9 100644
--- a/pgml-dashboard/static/css/scss/components/_navs.scss
+++ b/pgml-dashboard/static/css/scss/components/_navs.scss
@@ -195,18 +195,6 @@
}
}
-.leftnav {
- @extend .navbar;
-
- border: none;
- align-items: start;
- background-color: inherit;
-
- @include media-breakpoint-down(lg) {
- background-color: #{$gray-900}
- }
-}
-
.toc, .guides {
--bs-border-color: #{$gray-500};
.nav-link {
@@ -265,11 +253,14 @@
color: #{$neon-shade-300};
}
- & button, & a {
+ button, a {
padding: 8px 24px 8px 24px;
color: #{$gray-100};
width: 100%;
transition: padding $animation-timer;
+
+ text-overflow: ellipsis;
+ overflow: hidden;
}
&:hover {
From 0ec0817899ca413c1e04d724345df7e6e95822c6 Mon Sep 17 00:00:00 2001
From: Lev Kokotov
Date: Fri, 1 Sep 2023 09:01:15 -0700
Subject: [PATCH 02/18] lint
---
pgml-dashboard/.editorconfig | 4 ++
.../src/components/dropdown/dropdown.scss | 64 +++++++++----------
2 files changed, 36 insertions(+), 32 deletions(-)
create mode 100644 pgml-dashboard/.editorconfig
diff --git a/pgml-dashboard/.editorconfig b/pgml-dashboard/.editorconfig
new file mode 100644
index 000000000..9c9a9cb3f
--- /dev/null
+++ b/pgml-dashboard/.editorconfig
@@ -0,0 +1,4 @@
+
+[*.scss]
+indent_style = space
+indent_size = 4
diff --git a/pgml-dashboard/src/components/dropdown/dropdown.scss b/pgml-dashboard/src/components/dropdown/dropdown.scss
index 72a1081df..a20634218 100644
--- a/pgml-dashboard/src/components/dropdown/dropdown.scss
+++ b/pgml-dashboard/src/components/dropdown/dropdown.scss
@@ -1,24 +1,24 @@
.dropdown {
- @extend .d-flex;
- width: 100%;
-
- .dropdown-toggle {
- a {
- padding: 8px 12px;
- }
-
- &:hover {
- cursor: pointer;
- }
-
- &:after {
- content: none;
- }
- }
-
- .dropdown-menu {
- width: 100%;
- }
+ @extend .d-flex;
+ width: 100%;
+
+ .dropdown-toggle {
+ a {
+ padding: 8px 12px;
+ }
+
+ &:hover {
+ cursor: pointer;
+ }
+
+ &:after {
+ content: none;
+ }
+ }
+
+ .dropdown-menu {
+ width: 100%;
+ }
}
.btn-dropdown {
@@ -63,18 +63,18 @@
}
.menu-item {
- a {
- padding: 8px 12px;
- }
-
- &:hover {
- cursor: pointer;
- }
-
- &:after {
- content: None;
- }
- }
+ a {
+ padding: 8px 12px;
+ }
+
+ &:hover {
+ cursor: pointer;
+ }
+
+ &:after {
+ content: None;
+ }
+ }
}
From 122f289ade78e23ec5e17e91e1de8f5d11cdfc12 Mon Sep 17 00:00:00 2001
From: Lev Kokotov
Date: Fri, 1 Sep 2023 09:29:51 -0700
Subject: [PATCH 03/18] Fix collapse
---
pgml-dashboard/src/components/dropdown/mod.rs | 13 ++++++++++++-
.../src/components/dropdown/template.html | 4 ++--
.../src/components/left_nav_web_app/template.html | 2 +-
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/pgml-dashboard/src/components/dropdown/mod.rs b/pgml-dashboard/src/components/dropdown/mod.rs
index bdc17eae4..c9e95ef53 100644
--- a/pgml-dashboard/src/components/dropdown/mod.rs
+++ b/pgml-dashboard/src/components/dropdown/mod.rs
@@ -6,12 +6,18 @@ use crate::components::StaticNavLink;
#[derive(TemplateOnce, Default)]
#[template(path = "dropdown/template.html")]
pub struct Dropdown {
+ //github.com/ The currently selected value.
value: String,
+
+ //github.com/ The list of dropdown links to render.
links: Vec,
+
+ //github.com/ Whether or not the dropdown is collapsble.
+ collapsable: bool,
}
impl Dropdown {
- pub fn new(links: Vec) -> Dropdown {
+ pub fn new(links: Vec) -> Self {
let binding = links
.iter()
.filter(|link| link.active)
@@ -28,6 +34,11 @@ impl Dropdown {
..Default::default()
}
}
+
+ pub fn collapsable(mut self) -> Self {
+ self.collapsable = true;
+ self
+ }
}
component!(Dropdown);
diff --git a/pgml-dashboard/src/components/dropdown/template.html b/pgml-dashboard/src/components/dropdown/template.html
index f6b02e3c1..55bd78cac 100644
--- a/pgml-dashboard/src/components/dropdown/template.html
+++ b/pgml-dashboard/src/components/dropdown/template.html
@@ -1,12 +1,12 @@
-