-
Notifications
You must be signed in to change notification settings - Fork 318
onboarding modules #1391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
onboarding modules #1391
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1b610ef
onboarding modules
levkk 5ad0db4
components
levkk de14827
remove unused controller
levkk 675d20a
remove warning
levkk 39d9327
range input v2
levkk f336529
mods
levkk 7b14db0
separate input value from dropdown value
levkk a62a18e
better name
levkk df67e9c
method name
levkk 1d7ea84
switch v2
levkk 57089fd
radio + debug on Component
levkk 47c4b81
vertical option
levkk b2f37a7
comments
levkk c1467d5
fixes
levkk b155784
rgb card
levkk 2c53965
use input value
levkk 29c109b
hmm
levkk 6fe6361
backwards compatible
levkk a6aebfc
icon
levkk aefb18c
addressing comments
levkk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
pgml-dashboard/src/components/badges/large/label/label.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
span[data-controller="badges-large-label"] { | ||
padding: 8px; | ||
background: #{$gray-500}; | ||
font-weight: #{$font-weight-medium}; | ||
border: 1px solid #{$neon-tint-100}; | ||
|
||
&.active { | ||
background: #{$neon-tint-100}; | ||
border: 1px solid #{$neon-tint-600}; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use crate::components::stimulus::StimulusAction; | ||
use pgml_components::component; | ||
use sailfish::TemplateOnce; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct LabelCloseOptions { | ||
pub action: StimulusAction, | ||
pub url: String, | ||
} | ||
|
||
#[derive(TemplateOnce, Default)] | ||
#[template(path = "badges/large/label/template.html")] | ||
pub struct Label { | ||
value: String, | ||
close_options: Option<LabelCloseOptions>, | ||
active: String, | ||
} | ||
|
||
impl Label { | ||
pub fn new(value: &str) -> Label { | ||
Label { | ||
value: value.into(), | ||
close_options: None, | ||
active: "".into(), | ||
} | ||
} | ||
|
||
pub fn close_options(mut self, options: LabelCloseOptions) -> Label { | ||
self.close_options = Some(options); | ||
self | ||
} | ||
|
||
pub fn active(mut self) -> Label { | ||
self.active = "active".into(); | ||
self | ||
} | ||
} | ||
|
||
component!(Label); |
12 changes: 12 additions & 0 deletions
12
pgml-dashboard/src/components/badges/large/label/template.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<% use crate::components::badges::large::label::LabelCloseOptions; %> | ||
|
||
<span data-controller="badges-large-label" class="d-inline-flex gap-2 align-items-center rounded-2 <%= active %>"> | ||
<span><%= value %></span> | ||
<% if let Some(LabelCloseOptions { action, url }) = close_options { %> | ||
<a href="<%= url %>" data-action="<%= action %>" class="d-inline-flex align-items-center"> | ||
<span class="material-symbols-outlined text-white"> | ||
close | ||
</span> | ||
</a> | ||
<% } %> | ||
</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// This file is automatically generated. | ||
// You shouldn't modify it manually. | ||
|
||
// src/components/badges/large/label | ||
pub mod label; | ||
pub use label::Label; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// This file is automatically generated. | ||
// You shouldn't modify it manually. | ||
|
||
// src/components/badges/large | ||
pub mod large; | ||
|
||
// src/components/badges/small | ||
pub mod small; |
12 changes: 12 additions & 0 deletions
12
pgml-dashboard/src/components/badges/small/label/label.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
span[data-controller="badges-small-label"] { | ||
span { | ||
font-size: 12px; | ||
font-weight: #{$font-weight-normal}; | ||
} | ||
|
||
background: #{$gray-800}; | ||
padding: 4px 8px; | ||
border-radius: 4px; | ||
|
||
text-transform: uppercase; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use pgml_components::component; | ||
use sailfish::TemplateOnce; | ||
|
||
#[derive(TemplateOnce, Default)] | ||
#[template(path = "badges/small/label/template.html")] | ||
pub struct Label { | ||
value: String, | ||
image_url: String, | ||
} | ||
|
||
impl Label { | ||
pub fn check_circle(value: &str) -> Label { | ||
Label { | ||
value: value.into(), | ||
image_url: "/dashboard/static/images/icons/check_circle.svg".to_string(), | ||
} | ||
} | ||
|
||
pub fn cancel(value: &str) -> Label { | ||
Label { | ||
value: value.into(), | ||
image_url: "/dashboard/static/images/icons/cancel.svg".to_string(), | ||
} | ||
} | ||
|
||
pub fn outbound(value: &str) -> Label { | ||
Label { | ||
value: value.into(), | ||
image_url: "/dashboard/static/images/icons/outbound.svg".to_string(), | ||
} | ||
} | ||
|
||
pub fn download_for_offline(value: &str) -> Label { | ||
Label { | ||
value: value.into(), | ||
image_url: "/dashboard/static/images/icons/download_for_offline.svg".to_string(), | ||
} | ||
} | ||
|
||
pub fn forward_circle(value: &str) -> Label { | ||
Label { | ||
value: value.into(), | ||
image_url: "/dashboard/static/images/icons/forward_circle.svg".to_string(), | ||
} | ||
} | ||
} | ||
|
||
component!(Label); |
4 changes: 4 additions & 0 deletions
4
pgml-dashboard/src/components/badges/small/label/template.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<span data-controller="badges-small-label" class="d-inline-flex gap-2 align-items-center"> | ||
<img src="<%= image_url %>" alt="icon" aria-hidden="true" width="14" height="15"> | ||
<span><%= value %></span> | ||
</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// This file is automatically generated. | ||
// You shouldn't modify it manually. | ||
|
||
// src/components/badges/small/label | ||
pub mod label; | ||
pub use label::Label; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use pgml_components::{component, Component}; | ||
use sailfish::TemplateOnce; | ||
|
||
#[derive(TemplateOnce)] | ||
#[template(path = "cards/rgb/template.html")] | ||
pub struct Rgb { | ||
value: Component, | ||
active: bool, | ||
link: Option<String>, | ||
} | ||
|
||
impl Default for Rgb { | ||
fn default() -> Self { | ||
Rgb::new("RGB card".into()) | ||
} | ||
} | ||
|
||
impl Rgb { | ||
pub fn new(value: Component) -> Rgb { | ||
Rgb { | ||
value, | ||
active: false, | ||
link: None, | ||
} | ||
} | ||
|
||
pub fn active(mut self) -> Self { | ||
self.active = true; | ||
self | ||
} | ||
|
||
pub fn link(mut self, link: &str) -> Self { | ||
self.link = Some(link.to_string()); | ||
self | ||
} | ||
} | ||
|
||
component!(Rgb); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
div[data-controller="cards-rgb"] { | ||
.card { | ||
--bs-card-bg: transparent; | ||
--bs-card-border-color: #{$gray-700}; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Controller } from "@hotwired/stimulus"; | ||
|
||
export default class extends Controller { | ||
// Activate this card (add RGB). | ||
active() { | ||
this.element | ||
.querySelector(".card") | ||
.classList.add("main-gradient-border-card-1"); | ||
} | ||
|
||
// Deactivate this card (remove RGB). | ||
inactive() { | ||
this.element | ||
.querySelector(".card") | ||
.classList.remove("main-gradient-border-card-1"); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<% let active = if active { "main-gradient-border-card-1 active" } else { "" }; %> | ||
<div data-controller="cards-rgb"> | ||
<div class="card <%= active %>"> | ||
<div class="card-body"> | ||
<%+ value %> | ||
<% if let Some(link) = link { %> | ||
<a href="<%= link %>" class="stretched-link"></a> | ||
<% } %> | ||
</div> | ||
</div> | ||
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<% if let Some(src) = src { %> | ||
<turbo-frame src="<%= src %>" id="<%= id %>"> | ||
</turbo-frame> | ||
<% } else { %> | ||
<turbo-frame id="<%= id %>"> | ||
<%+ content %> | ||
</turbo-frame> | ||
<% } %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<% for item in items { %> | ||
<%+ item %> | ||
<% } %> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't tell but If this doesn't have a hover state, it needs one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it doesn't have one. I don't think there is one in the design. I'll flag it for review and follow up with a PR.