diff --git a/pgml-dashboard/src/components/inputs/range_group/range_group.scss b/pgml-dashboard/src/components/inputs/range_group/range_group.scss index da68a1172..cc2186951 100644 --- a/pgml-dashboard/src/components/inputs/range_group/range_group.scss +++ b/pgml-dashboard/src/components/inputs/range_group/range_group.scss @@ -4,19 +4,8 @@ div[data-controller="inputs-range-group"] { } .hourly-rate { - display: flex; - flex-direction: row; background-color: #{$gray-900}; - border-radius: $border-radius; - padding: 8px 4px; - color: #{$gray-400}; - text-align: center; - font-size: 18px; - font-style: normal; - font-weight: 700; - line-height: 24px; - letter-spacing: 0.18px; } .cost { diff --git a/pgml-dashboard/src/components/inputs/range_group/template.html b/pgml-dashboard/src/components/inputs/range_group/template.html index f70e5cc8c..14f38b536 100644 --- a/pgml-dashboard/src/components/inputs/range_group/template.html +++ b/pgml-dashboard/src/components/inputs/range_group/template.html @@ -42,12 +42,14 @@
<%- title %>
+
<% for info in item { %> <% } %>
+
<% for info in item { %> diff --git a/pgml-dashboard/src/components/inputs/select/select_controller.js b/pgml-dashboard/src/components/inputs/select/select_controller.js index e7c712dba..d5321f1b0 100644 --- a/pgml-dashboard/src/components/inputs/select/select_controller.js +++ b/pgml-dashboard/src/components/inputs/select/select_controller.js @@ -4,8 +4,16 @@ export default class extends Controller { static targets = ["input", "value"] choose(e) { - this.inputTarget.value = e.target.innerHTML - this.valueTarget.innerHTML = e.target.innerHTML + this.setValue(e.target.innerHTML) + } + + resetSelect() { + this.setValue(this.element.dataset.initial) + } + + setValue(value) { + this.inputTarget.value = value + this.valueTarget.innerHTML = value this.inputTarget.dispatchEvent(new Event('change')) } } diff --git a/pgml-dashboard/src/components/inputs/select/template.html b/pgml-dashboard/src/components/inputs/select/template.html index b158717bc..4bc33ecd4 100644 --- a/pgml-dashboard/src/components/inputs/select/template.html +++ b/pgml-dashboard/src/components/inputs/select/template.html @@ -2,7 +2,7 @@ use crate::components::dropdown::Dropdown; use crate::components::stimulus::stimulus_target::StimulusTarget; %> -
+
<% let mut dropdown = Dropdown::new() .items(options) @@ -29,5 +29,5 @@ <%+ dropdown %> - data-action="<%- action %>" /> + data-action="<%- action %> reset->inputs-select#resetSelect" />
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 @@
<<%= header_type.to_string() %> class="align-items-center <%= header_type.to_string() %> d-flex gap-3"> - + <%= value %> diff --git a/pgml-dashboard/src/components/lists/item/mod.rs b/pgml-dashboard/src/components/lists/item/mod.rs new file mode 100644 index 000000000..8a0ff1645 --- /dev/null +++ b/pgml-dashboard/src/components/lists/item/mod.rs @@ -0,0 +1,23 @@ +use pgml_components::component; +use sailfish::TemplateOnce; + +#[derive(TemplateOnce, Default)] +#[template(path = "lists/item/template.html")] +pub struct Item { + value: String, +} + +impl Item { + pub fn new() -> Item { + Item { + value: String::from("Your list item"), + } + } + + pub fn value(mut self, value: &str) -> Item { + self.value = value.into(); + self + } +} + +component!(Item); diff --git a/pgml-dashboard/src/components/lists/item/template.html b/pgml-dashboard/src/components/lists/item/template.html new file mode 100644 index 000000000..7df3b5ec6 --- /dev/null +++ b/pgml-dashboard/src/components/lists/item/template.html @@ -0,0 +1,4 @@ +
+ Checkmark + <%- value %> +
diff --git a/pgml-dashboard/src/components/lists/mod.rs b/pgml-dashboard/src/components/lists/mod.rs new file mode 100644 index 000000000..ac438d6cd --- /dev/null +++ b/pgml-dashboard/src/components/lists/mod.rs @@ -0,0 +1,6 @@ +// This file is automatically generated. +// You shouldn't modify it manually. + +// src/components/lists/item +pub mod item; +pub use item::Item; diff --git a/pgml-dashboard/src/components/mod.rs b/pgml-dashboard/src/components/mod.rs index bb92bae97..4db70e0da 100644 --- a/pgml-dashboard/src/components/mod.rs +++ b/pgml-dashboard/src/components/mod.rs @@ -32,6 +32,9 @@ pub mod inputs; pub mod left_nav_menu; pub use left_nav_menu::LeftNavMenu; +// src/components/lists +pub mod lists; + // src/components/modal pub mod modal; pub use modal::Modal; diff --git a/pgml-dashboard/static/css/scss/abstracts/variables.scss b/pgml-dashboard/static/css/scss/abstracts/variables.scss index 943b80b54..41e35b75b 100644 --- a/pgml-dashboard/static/css/scss/abstracts/variables.scss +++ b/pgml-dashboard/static/css/scss/abstracts/variables.scss @@ -97,13 +97,24 @@ $slate-shade-800: #2B274C; $slate-shade-900: #1D1A33; $slate-shade-1000: #0E0D19; +$magenta-shade-100: #E6008A; +$magenta-shade-200: #cf007c; +$magenta-shade-300: #b8006e; +$magenta-shade-400: #a10060; +$magenta-shade-500: #8a0052; +$magenta-shade-600: #730045; +$magenta-shade-700: #5c0037; +$magenta-shade-800: #450029; +$magenta-shade-900: #2e001b; +$magenta-shade-1000: #17000d; + // Colors $primary: #0D0D0E; $secondary: $gray-100; $danger: $peach-shade-100; $error: $peach-shade-100; $purple: $slate-tint-100; -$pink: #e7477c; +$pink: $magenta-shade-100; $hp-white: #{$gray-200}; // Background Colors diff --git a/pgml-dashboard/static/css/scss/components/_badges.scss b/pgml-dashboard/static/css/scss/components/_badges.scss index 851ca68aa..ebb3ac4a5 100644 --- a/pgml-dashboard/static/css/scss/components/_badges.scss +++ b/pgml-dashboard/static/css/scss/components/_badges.scss @@ -5,8 +5,7 @@ align-items: center; } -.version-badge { - @extend .badge; +.eyebrow-badge { text-transform: uppercase; color: #{$pink}; } diff --git a/pgml-dashboard/static/css/scss/components/_forms.scss b/pgml-dashboard/static/css/scss/components/_forms.scss index cc11d237c..14231ce0c 100644 --- a/pgml-dashboard/static/css/scss/components/_forms.scss +++ b/pgml-dashboard/static/css/scss/components/_forms.scss @@ -256,3 +256,20 @@ background: transparent; caret-color: #{$input-color}; } + +.hourly-rate { + display: flex; + flex-direction: row; + gap: .5rem; + background-color: #{$gray-900}; + border-radius: $border-radius; + padding: 16px 20px; + + color: #{$gray-400}; + text-align: center; + font-size: 18px; + font-style: normal; + font-weight: 700; + line-height: 24px; + letter-spacing: 0.18px; +} diff --git a/pgml-dashboard/templates/content/playground.html b/pgml-dashboard/templates/content/playground.html index 5dc8dcebf..1ad2539e1 100644 --- a/pgml-dashboard/templates/content/playground.html +++ b/pgml-dashboard/templates/content/playground.html @@ -7,7 +7,7 @@ use crate::components::stimulus::stimulus_action::StimulusAction; use crate::components::stimulus::stimulus_action::StimulusEvents; use crate::components::inputs::select::Select; -use crate::components::inputs::switch::Switch; +use crate::components::inputs::switch::{Switch, State}; %>
@@ -223,7 +223,7 @@

Inputs

.name("switch")) .left("CPU", "memory") .right("GPU", "mode_fan") - .start_toggled() %> + .default_position(State::Right) %>
diff --git a/pgml-dashboard/templates/layout/web_app_base.html b/pgml-dashboard/templates/layout/web_app_base.html index a84ce5e8e..e3ababb5e 100644 --- a/pgml-dashboard/templates/layout/web_app_base.html +++ b/pgml-dashboard/templates/layout/web_app_base.html @@ -30,7 +30,7 @@ <%+ WebAppLeftNav::new( upper_left_nav, lower_left_nav, dropdown_nav ) %>
-
+
<%- Breadcrumbs::render( breadcrumbs ) %>