Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Onboarding components fixes#1393

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
levkk merged 27 commits intomasterfromlevkk-onboarding-fixes
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
27 commits
Select commitHold shift + click to select a range
d77a085
Onboarding fixes
levkkApr 2, 2024
56f8d5b
remove hover animation
levkkApr 2, 2024
288b930
gray heading
levkkApr 2, 2024
119c20e
Secondary card
levkkApr 2, 2024
52f6f58
more actions
levkkApr 2, 2024
8e0eddd
input value
levkkApr 2, 2024
ab12345
required input
levkkApr 2, 2024
1e58f5f
rgb link action
levkkApr 3, 2024
1356a7a
cost frequency
levkkApr 3, 2024
7c33e42
card
levkkApr 3, 2024
d88f3d5
input unit
levkkApr 3, 2024
c2e4efc
zindex
levkkApr 3, 2024
f8b6144
preserve scroll
levkkApr 3, 2024
39f901c
warning
levkkApr 3, 2024
b7c6cad
link
levkkApr 4, 2024
6d1b89e
link
levkkApr 4, 2024
c81672a
set active
levkkApr 4, 2024
ba0ecab
save
levkkApr 4, 2024
d7adb48
is_active
levkkApr 4, 2024
e1f4fc3
change event
levkkApr 4, 2024
e569e9f
remove
levkkApr 4, 2024
c26fde7
fix input field
levkkApr 5, 2024
821c393
css
levkkApr 5, 2024
6b35316
Revert "css"
levkkApr 5, 2024
4879161
fix input again
levkkApr 5, 2024
abf06fe
fix input unit
levkkApr 5, 2024
8ea6cef
dead code
levkkApr 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
Onboarding fixes
  • Loading branch information
@levkk
levkk committedApr 4, 2024
commitd77a085f6f05095fef33e08b3b176d4cf5325b40
17 changes: 14 additions & 3 deletionspgml-dashboard/src/components/cards/rgb/mod.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,8 +5,10 @@ use sailfish::TemplateOnce;
#[template(path = "cards/rgb/template.html")]
pub struct Rgb {
value: Component,
active: bool,
link: Option<String>,
controller_classes: Vec<String>,
card_classes: Vec<String>,
body_classes: Vec<String>,
}

impl Default for Rgb {
Expand All@@ -19,20 +21,29 @@ impl Rgb {
pub fn new(value: Component) -> Rgb {
Rgb {
value,
active: false,
link: None,
controller_classes: vec![],
card_classes: vec![],
body_classes: vec![],
}
}

pub fn active(mut self) -> Self {
self.active = true;
self.card_classes.push("active".into());
self.card_classes.push("main-gradient-border-card-1".into());
self
}

pub fn link(mut self, link: &str) -> Self {
self.link = Some(link.to_string());
self
}

pub fn h_100(mut self) -> Self {
self.controller_classes.push("h-100".into());
self.card_classes.push("h-100".into());
self
Comment on lines +61 to +64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

for something like this is it possible to just always have the h-100 on and for instances where you need to limit the height, place it in a wrapper that does not have h-100? Just brainstorming, this could turn into a slippery slope of having a function for every specific situation. I think if it is possible to solve problems like this with wrappers, we should.

levkk reacted with thumbs up emoji
Copy link
ContributorAuthor

@levkklevkkApr 5, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

By default, the card occupies as much space as it needs to render its contents. The.h-100 here helps cards look uniform when placed inside a grid. Our cards don't have the same contents, so their heights will vary when placed inside a grid like.row or.d-flex. If we have.h-100 by default, the card will always occupy the full height of its container which is not desired when the card is used by itself inside something like a<div>. So.h-100 is a special case that we just happen to use quite often, but not always.

A wrapper can't make its child occupy 100% of its space unless we add additional CSS to the wrapper knowing that the child needs to do this. For example, here we could do something like:

.card-wrapper-h-100 {    @extend.h-100.card {          @extend.h-100.card-body {                @extend.h-100          }    }}

which now that I'm writing this isn't too bad. One issue with this is more of a theoretical technicality, where a component "reaches inside" another component and modifies its state which could cause weird bugs later on. It's typically best to have the component use public methods to modify its state in a predicable way.

Maybe if we name this slightly differently, it could be better? I'm not leaning strongly one way or the other.

}
}

component!(Rgb);
12 changes: 8 additions & 4 deletionspgml-dashboard/src/components/cards/rgb/template.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +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">
<%
let controller_classes = controller_classes.join(" ");
let card_classes = card_classes.join(" ");
let body_classes = body_classes.join(" ");
%>
<div data-controller="cards-rgb" class="<%= controller_classes %>">
<div class="card <%= card_classes %>">
<div class="card-body <%= body_classes %>">
<%+ value %>
<% if let Some(link) = link { %>
<a href="<%= link %>" class="stretched-link"></a>
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp