Skip to content

Commit 044ec86

Browse files
Dan updates for post mvp dbs (#1117)
1 parent b0f91e3 commit 044ec86

File tree

18 files changed

+96
-25
lines changed

18 files changed

+96
-25
lines changed

pgml-dashboard/src/components/inputs/range_group/range_group.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,8 @@ div[data-controller="inputs-range-group"] {
44
}
55

66
.hourly-rate {
7-
display: flex;
8-
flex-direction: row;
97
background-color: #{$gray-900};
10-
border-radius: $border-radius;
11-
padding: 8px 4px;
12-
138
color: #{$gray-400};
14-
text-align: center;
15-
font-size: 18px;
16-
font-style: normal;
17-
font-weight: 700;
18-
line-height: 24px;
19-
letter-spacing: 0.18px;
209
}
2110

2211
.cost {

pgml-dashboard/src/components/inputs/range_group/template.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,14 @@ <h6 class="h6"><%- title %></h6>
4242
<div class="tick-unit">
4343
<div class="tick" data-inputs-range-group-target="tick"></div>
4444

45+
<!-- large screen content -->
4546
<div class="d-none d-lg-flex flex-column text-nowrap mt-2 tick-text" data-inputs-range-group-target="tickText">
4647
<% for info in item { %>
4748
<div class="legal-text fw-bold" ><%- info %></div>
4849
<% } %>
4950
</div>
5051

52+
<!-- small screen content -->
5153
<div class="d-block d-lg-none">
5254
<div class="flex-column text-nowrap mt-2 tick-text" data-inputs-range-group-target="smScreenText">
5355
<% for info in item { %>

pgml-dashboard/src/components/inputs/select/select_controller.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@ export default class extends Controller {
44
static targets = ["input", "value"]
55

66
choose(e) {
7-
this.inputTarget.value = e.target.innerHTML
8-
this.valueTarget.innerHTML = e.target.innerHTML
7+
this.setValue(e.target.innerHTML)
8+
}
9+
10+
resetSelect() {
11+
this.setValue(this.element.dataset.initial)
12+
}
13+
14+
setValue(value) {
15+
this.inputTarget.value = value
16+
this.valueTarget.innerHTML = value
917
this.inputTarget.dispatchEvent(new Event('change'))
1018
}
1119
}

pgml-dashboard/src/components/inputs/select/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use crate::components::dropdown::Dropdown;
33
use crate::components::stimulus::stimulus_target::StimulusTarget;
44
%>
5-
<div data-controller="inputs-select">
5+
<div data-controller="inputs-select" data-initial="<%- value.clone() %>">
66

77
<% let mut dropdown = Dropdown::new()
88
.items(options)
@@ -29,5 +29,5 @@
2929

3030
<%+ dropdown %>
3131

32-
<input type="hidden" name="<%= name %>" value="<%= value %>" data-inputs-select-target="input" <%- value_target %> data-action="<%- action %>" />
32+
<input type="hidden" name="<%= name %>" value="<%= value %>" data-inputs-select-target="input" <%- value_target %> data-action="<%- action %> reset->inputs-select#resetSelect" />
3333
</div>

pgml-dashboard/src/components/inputs/switch/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ impl Switch {
6060
self
6161
}
6262

63-
pub fn start_toggled(mut self) -> Switch {
64-
self.initial_state = State::Right;
63+
pub fn default_position(mut self, state: State) -> Switch {
64+
self.initial_state = state;
6565
self
6666
}
6767

pgml-dashboard/src/components/inputs/switch/switch.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ div[data-controller="inputs-switch"] {
77
}
88

99
.label {
10-
padding: 8px 20px;
10+
padding: 8px 40px;
1111
border-radius: 5rem;
1212
text-align: center;
1313
display: flex;
1414
justify-content: center;
15+
align-items: center;
1516
@extend .gap-2;
1617
}
1718

pgml-dashboard/src/components/inputs/text/editable_header/editable_header.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,10 @@ div[data-controller="inputs-text-editable-header"] {
3333
padding: 0px;
3434
margin-bottom: -2px; // compensate for border space
3535
}
36+
37+
#title {
38+
&.error {
39+
border-bottom: 1px solid #{$error}
40+
}
41+
}
3642
}

pgml-dashboard/src/components/inputs/text/editable_header/editable_header_controller.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ export default class extends Controller {
3131
error(e) {
3232
this.errorTarget.innerHTML = e.detail
3333
this.errorTarget.style.display = "block"
34+
this.headerTarget.classList.add("error")
3435
}
3536

3637
clear() {
3738
this.errorTarget.style.display = "none"
39+
this.headerTarget.classList.remove("error")
3840
}
3941
}

pgml-dashboard/src/components/inputs/text/editable_header/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="editable-header-container" style="display: block"
66
data-action="click->inputs-text-editable-header#toggleEditor">
77
<<%= header_type.to_string() %> class="align-items-center <%= header_type.to_string() %> d-flex gap-3">
8-
<span data-inputs-text-editable-header-target="header">
8+
<span data-inputs-text-editable-header-target="header" id="title">
99
<%= value %>
1010
</span>
1111

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use pgml_components::component;
2+
use sailfish::TemplateOnce;
3+
4+
#[derive(TemplateOnce, Default)]
5+
#[template(path = "lists/item/template.html")]
6+
pub struct Item {
7+
value: String,
8+
}
9+
10+
impl Item {
11+
pub fn new() -> Item {
12+
Item {
13+
value: String::from("Your list item"),
14+
}
15+
}
16+
17+
pub fn value(mut self, value: &str) -> Item {
18+
self.value = value.into();
19+
self
20+
}
21+
}
22+
23+
component!(Item);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<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">
3+
<%- value %>
4+
</div>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This file is automatically generated.
2+
// You shouldn't modify it manually.
3+
4+
// src/components/lists/item
5+
pub mod item;
6+
pub use item::Item;

pgml-dashboard/src/components/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ pub mod inputs;
3232
pub mod left_nav_menu;
3333
pub use left_nav_menu::LeftNavMenu;
3434

35+
// src/components/lists
36+
pub mod lists;
37+
3538
// src/components/modal
3639
pub mod modal;
3740
pub use modal::Modal;

pgml-dashboard/static/css/scss/abstracts/variables.scss

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,24 @@ $slate-shade-800: #2B274C;
9797
$slate-shade-900: #1D1A33;
9898
$slate-shade-1000: #0E0D19;
9999

100+
$magenta-shade-100: #E6008A;
101+
$magenta-shade-200: #cf007c;
102+
$magenta-shade-300: #b8006e;
103+
$magenta-shade-400: #a10060;
104+
$magenta-shade-500: #8a0052;
105+
$magenta-shade-600: #730045;
106+
$magenta-shade-700: #5c0037;
107+
$magenta-shade-800: #450029;
108+
$magenta-shade-900: #2e001b;
109+
$magenta-shade-1000: #17000d;
110+
100111
// Colors
101112
$primary: #0D0D0E;
102113
$secondary: $gray-100;
103114
$danger: $peach-shade-100;
104115
$error: $peach-shade-100;
105116
$purple: $slate-tint-100;
106-
$pink: #e7477c;
117+
$pink: $magenta-shade-100;
107118
$hp-white: #{$gray-200};
108119

109120
// Background Colors

pgml-dashboard/static/css/scss/components/_badges.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
align-items: center;
66
}
77

8-
.version-badge {
9-
@extend .badge;
8+
.eyebrow-badge {
109
text-transform: uppercase;
1110
color: #{$pink};
1211
}

pgml-dashboard/static/css/scss/components/_forms.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,20 @@
256256
background: transparent;
257257
caret-color: #{$input-color};
258258
}
259+
260+
.hourly-rate {
261+
display: flex;
262+
flex-direction: row;
263+
gap: .5rem;
264+
background-color: #{$gray-900};
265+
border-radius: $border-radius;
266+
padding: 16px 20px;
267+
268+
color: #{$gray-400};
269+
text-align: center;
270+
font-size: 18px;
271+
font-style: normal;
272+
font-weight: 700;
273+
line-height: 24px;
274+
letter-spacing: 0.18px;
275+
}

pgml-dashboard/templates/content/playground.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use crate::components::stimulus::stimulus_action::StimulusAction;
88
// use crate::components::stimulus::stimulus_action::StimulusEvents;
99
use crate::components::inputs::select::Select;
10-
use crate::components::inputs::switch::Switch;
10+
use crate::components::inputs::switch::{Switch, State};
1111
%>
1212

1313
<div class="min-height: 100vh;" data-controller="playground">
@@ -223,7 +223,7 @@ <h3 class="h3">Inputs</h3>
223223
.name("switch"))
224224
.left("CPU", "memory")
225225
.right("GPU", "mode_fan")
226-
.start_toggled() %>
226+
.default_position(State::Right) %>
227227
</div>
228228
<div>
229229
<button data-action="click->playground#resetSwitch">Reset Switch</button>

pgml-dashboard/templates/layout/web_app_base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<%+ WebAppLeftNav::new( upper_left_nav, lower_left_nav, dropdown_nav ) %>
3131

3232
<div class="clear-from-under-navbar flex-grow-1 min-vw-0">
33-
<div class="px-5 py-3" style="position: absolute">
33+
<div class="px-4 px-sm-5 py-3" style="position: absolute">
3434
<%- Breadcrumbs::render( breadcrumbs ) %>
3535
</div>
3636

0 commit comments

Comments
 (0)