From 05f9a8910a0724f6d488385d1c25b20274bbfd19 Mon Sep 17 00:00:00 2001 From: Dan <39170265+chillenberger@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:51:35 -0600 Subject: [PATCH 1/3] badge styling, list item component, variable update --- .../src/components/inputs/switch/mod.rs | 4 ++-- .../src/components/inputs/switch/switch.scss | 3 ++- .../text/editable_header/editable_header.scss | 6 +++++ .../editable_header_controller.js | 2 ++ .../inputs/text/editable_header/template.html | 2 +- .../src/components/lists/item/item.scss | 3 +++ .../components/lists/item/item_controller.js | 14 +++++++++++ .../src/components/lists/item/mod.rs | 23 +++++++++++++++++++ .../src/components/lists/item/template.html | 4 ++++ pgml-dashboard/src/components/lists/mod.rs | 6 +++++ pgml-dashboard/src/components/mod.rs | 3 +++ pgml-dashboard/static/css/modules.scss | 1 + .../static/css/scss/abstracts/variables.scss | 13 ++++++++++- .../static/css/scss/components/_badges.scss | 3 +-- .../templates/content/playground.html | 4 ++-- .../templates/layout/web_app_base.html | 2 +- 16 files changed, 83 insertions(+), 10 deletions(-) create mode 100644 pgml-dashboard/src/components/lists/item/item.scss create mode 100644 pgml-dashboard/src/components/lists/item/item_controller.js create mode 100644 pgml-dashboard/src/components/lists/item/mod.rs create mode 100644 pgml-dashboard/src/components/lists/item/template.html create mode 100644 pgml-dashboard/src/components/lists/mod.rs diff --git a/pgml-dashboard/src/components/inputs/switch/mod.rs b/pgml-dashboard/src/components/inputs/switch/mod.rs index 389fde568..7db04ae71 100644 --- a/pgml-dashboard/src/components/inputs/switch/mod.rs +++ b/pgml-dashboard/src/components/inputs/switch/mod.rs @@ -60,8 +60,8 @@ impl Switch { self } - pub fn start_toggled(mut self) -> Switch { - self.initial_state = State::Right; + pub fn default_position(mut self, state: State) -> Switch { + self.initial_state = state; self } diff --git a/pgml-dashboard/src/components/inputs/switch/switch.scss b/pgml-dashboard/src/components/inputs/switch/switch.scss index ac8ffe4d9..af6e97af8 100644 --- a/pgml-dashboard/src/components/inputs/switch/switch.scss +++ b/pgml-dashboard/src/components/inputs/switch/switch.scss @@ -7,11 +7,12 @@ div[data-controller="inputs-switch"] { } .label { - padding: 8px 20px; + padding: 8px 40px; border-radius: 5rem; text-align: center; display: flex; justify-content: center; + align-items: center; @extend .gap-2; } diff --git a/pgml-dashboard/src/components/inputs/text/editable_header/editable_header.scss b/pgml-dashboard/src/components/inputs/text/editable_header/editable_header.scss index 49b36cad9..709658e68 100644 --- a/pgml-dashboard/src/components/inputs/text/editable_header/editable_header.scss +++ b/pgml-dashboard/src/components/inputs/text/editable_header/editable_header.scss @@ -33,4 +33,10 @@ div[data-controller="inputs-text-editable-header"] { padding: 0px; margin-bottom: -2px; // compensate for border space } + + #title { + &.error { + border-bottom: 1px solid #{$error} + } + } } diff --git a/pgml-dashboard/src/components/inputs/text/editable_header/editable_header_controller.js b/pgml-dashboard/src/components/inputs/text/editable_header/editable_header_controller.js index e00b8cefb..b5195a087 100644 --- a/pgml-dashboard/src/components/inputs/text/editable_header/editable_header_controller.js +++ b/pgml-dashboard/src/components/inputs/text/editable_header/editable_header_controller.js @@ -31,9 +31,11 @@ export default class extends Controller { error(e) { this.errorTarget.innerHTML = e.detail this.errorTarget.style.display = "block" + this.headerTarget.classList.add("error") } clear() { this.errorTarget.style.display = "none" + this.headerTarget.classList.remove("error") } } diff --git a/pgml-dashboard/src/components/inputs/text/editable_header/template.html b/pgml-dashboard/src/components/inputs/text/editable_header/template.html index eb320ed5a..31c879a7b 100644 --- a/pgml-dashboard/src/components/inputs/text/editable_header/template.html +++ b/pgml-dashboard/src/components/inputs/text/editable_header/template.html @@ -5,7 +5,7 @@