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

Custom greeting area in split, checkbox component#1404

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 3 commits intomasterfromlevkk-profile-setup
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
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
17 changes: 17 additions & 0 deletionspgml-dashboard/src/components/inputs/checkbox/checkbox.scss
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
div[data-controller="inputs-checkbox"] {
.form-check-label {
padding-left: 8px;
user-select: none; // Annoying to constantly highlight the text when clicking too fast.
}

.form-check-input {
&:not(:checked) {
border-color: #{$neon-tint-100};
}

&:hover {
cursor: pointer;
}
}
}

26 changes: 26 additions & 0 deletionspgml-dashboard/src/components/inputs/checkbox/mod.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
use pgml_components::{component, Component};
use sailfish::TemplateOnce;

use crate::utils::random_string;

#[derive(TemplateOnce, Default)]
#[template(path = "inputs/checkbox/template.html")]
pub struct Checkbox {
name: String,
value: String,
label: Component,
id: String,
}

impl Checkbox {
pub fn new(name: &str, value: &str) -> Checkbox {
Checkbox {
name: name.to_string(),
value: value.to_string(),
label: Component::from(name),
id: random_string(16).to_lowercase(),
}
}
}

component!(Checkbox);
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
<div data-controller="inputs-checkbox">
<div class="form-check d-flex gap-2 align-items-center">
<input class="form-check-input" type="checkbox" id="<%= id %>" name="<%= name %>" value="<%= value %>">
<label class="form-check-label flex-grow-1" for="<%= id %>"><%+ label %></label>
</div>
</div>
4 changes: 4 additions & 0 deletionspgml-dashboard/src/components/inputs/mod.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
// This file is automatically generated.
// You shouldn't modify it manually.

// src/components/inputs/checkbox
pub mod checkbox;
pub use checkbox::Checkbox;

// src/components/inputs/radio
pub mod radio;
pub use radio::Radio;
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
use crate::components::sections::Split;
use crate::components::PostgresLogo;

leteyebrow_formated = r#"<span class="text-white-300">APPLY NOW</span>"#;
leteyebrow_formatted = r#"<span class="text-white-300 text-uppercase">Apply now</span>"#;

let path = format!("/careers/apply/{}",job_title.replace(" ", "-").to_lowercase());

Expand DownExpand Up@@ -105,8 +105,7 @@

<%+
Split::new()
.eyebrow(Component::from(eyebrow_formated))
.title(Component::from(job_title))
.greeting(Component::from(eyebrow_formatted), Component::from(job_title))
.display_area(Component::from(display_area))
.with_navbar()
%>
17 changes: 16 additions & 1 deletionpgml-dashboard/src/components/pages/demo/template.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@
<% use crate::components::stimulus::StimulusAction; %>
<% use crate::components::inputs::RangeGroupV2; %>
<% use crate::components::inputs::select::{Select, Option}; %>
<% use crate::components::inputs::{SwitchV2, Radio}; %>
<% use crate::components::inputs::{SwitchV2, Radio, Checkbox}; %>
<% use crate::components::cards::{Rgb, Secondary, Primary}; %>

<div class="container" data-controller="pages-demo">
Expand DownExpand Up@@ -186,4 +186,19 @@
</div>
</div>
</div>

<div class="py-5 mb-5">
<div class="card mb-3">
<div class="card-body">
<div class="d-flex">
<%+ Checkbox::new("Inline checkbox", "inline") %>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<%+ Checkbox::new("Take full width checkbox", "block") %>
</div>
</div>
</div>
</div>
10 changes: 10 additions & 0 deletionspgml-dashboard/src/components/sections/split/greeting.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
<div class="py-5 text-center text-lg-start greeting">
<h6 class="h6 text-uppercase mb-0">
<small class="eyebrow-text">
<%+ eyebrow %>
</small>
</h6>
<h2 class="display-1 fw-bold text-capitalize">
<%+ title %>
</h2>
</div>
36 changes: 27 additions & 9 deletionspgml-dashboard/src/components/sections/split/mod.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,51 @@
//! Left/right split used in onboarding, signup, careers, etc.

use pgml_components::component;
use pgml_components::Component;
use sailfish::TemplateOnce;

#[derive(TemplateOnce, Default)]
#[template(path = "sections/split/template.html")]
pub struct Split {
eyebrow: Component,
title: Component,
greeting_area: Component,
display_area: Component,
with_navbar: bool,
}

// Greeting with its own styling.
#[derive(TemplateOnce, Default, Clone)]
#[template(path = "sections/split/greeting.html")]
pub struct Greeting {
eyebrow: Component,
title: Component,
}

component!(Greeting);

impl Greeting {
pub fn new(eyebrow: Component, title: Component) -> Greeting {
Greeting { eyebrow, title }
}
}

impl Split {
pub fn new() -> Split {
Split {
eyebrow: Component::from(String::from("")),
title: Component::from(String::from("")),
display_area: Component::from(String::from("")),
greeting_area: Component::default(),
display_area: Component::default(),
with_navbar: false,
}
}

pub fn eyebrow(mut self, eyebrow: Component) -> Split {
self.eyebrow = eyebrow;
// Set the greeting.
pub fn greeting(mut self, eyebrow: Component, title: Component) -> Split {
self.greeting_area = Greeting::new(eyebrow, title).into();
self
}

pub fn title(mut self, title: Component) -> Split {
self.title = title;
// Set whatever you want on the left side of the display.
pub fn greeting_area(mut self, greeting_area: Component) -> Split {
self.greeting_area = greeting_area;
self
}

Expand Down
4 changes: 2 additions & 2 deletionspgml-dashboard/src/components/sections/split/split.scss
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,11 +7,11 @@ div[data-controller="sections-split"] {
}
}

.signup-left {
.sections-split-left {
background: #{$gray-700};
}

.signup-right {
.sections-split-right {
position: relative;
background-color: #{$gray-800};
overflow: hidden;
Expand Down
29 changes: 5 additions & 24 deletionspgml-dashboard/src/components/sections/split/template.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,23 @@
<%
use pgml_components::Component;

let greeting = format!(r#"
<div class="py-5 text-center text-lg-start greeting">
<h6 class="h6 text-uppercase mb-0">
<small class="eyebrow-text">
{}
</small>
</h6>
<h2 class="display-1 fw-bold" style="text-transform: capitalize">
{}
</h2>
</div>
"#,
eyebrow.render_once().unwrap(),
title.render_once().unwrap());
%>

<div data-controller="sections-split" class="">
<div data-controller="sections-split">
<div class="row h-100 gx-0">
<!-- left -->
<div class="col-6 d-none d-lg-block">
<div class="d-flex flex-columnsignup-left" style="height: 100%;">
<div class="d-flex flex-columnsections-split-left" style="height: 100%;">
<div class="d-flex flex-column position-sticky justify-content-center left-center<% if with_navbar {%>-navbar<% } %>">
<%+Component::from(greeting.clone()) %>
<%+greeting_area.clone() %>
</div>
</div>
</div>

<!-- right -->
<div class="col-12 col-lg-6 ">
<div class="d-flex flex-column align-items-center justify-content-centersignup-right pt-lg-5 pt-0 pb-5 px-3 right-center<% if with_navbar {%>-navbar<% } %>">
<div class="d-flex flex-column align-items-center justify-content-centersections-split-right pt-lg-5 pt-0 pb-5 px-3 right-center<% if with_navbar {%>-navbar<% } %>">
<div class="glow-1"></div>
<div class="glow-2"></div>
<div class="glow-3"></div>
<div class="glow-4"></div>
<div class="glow-5"></div>
<div class="d-flex d-lg-none"><%+Component::from(greeting) %></div>
<div class="d-flex d-lg-none"><%+greeting_area %></div>

<%+ display_area %>
</div>
Expand Down
1 change: 1 addition & 0 deletionspgml-dashboard/static/css/modules.scss
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,6 +20,7 @@
@import "../../src/components/headings/gray/gray.scss";
@import "../../src/components/icons/checkmark/checkmark.scss";
@import "../../src/components/icons/twitter/twitter.scss";
@import "../../src/components/inputs/checkbox/checkbox.scss";
@import "../../src/components/inputs/radio/radio.scss";
@import "../../src/components/inputs/range_group/range_group.scss";
@import "../../src/components/inputs/range_group_v_2/range_group_v_2.scss";
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp