- Notifications
You must be signed in to change notification settings - Fork328
Dan pricing page updates#1476
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
412664f
add check colors, add icon choice to list item, add psychedelic bg, t…
chillenberger435f617
Merge branch 'master' into Dan-pricing-page-updates
chillenberger755e695
Merge branch 'master' into Dan-pricing-page-updates
chillenbergerd43e073
add range component, new range group, add primary marketing cta
chillenbergerc755dd3
Merge branch 'master' into Dan-pricing-page-updates
chillenberger4b7ef7c
Merge branch 'master' into Dan-pricing-page-updates
chillenberger2888ca6
remove unneeded image
chillenbergerFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletionpgml-dashboard/src/components/cards/marketing/slider/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
11 changes: 0 additions & 11 deletionspgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe.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 |
---|---|---|
@@ -1,15 +1,4 @@ | ||
div[data-controller="cards-newsletter-subscribe"] { | ||
.message { | ||
display: none; | ||
2 changes: 1 addition & 1 deletionpgml-dashboard/src/components/cards/newsletter_subscribe/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
31 changes: 29 additions & 2 deletionspgml-dashboard/src/components/icons/checkmark/checkmark.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
17 changes: 7 additions & 10 deletionspgml-dashboard/src/components/icons/checkmark/mod.rs
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
8 changes: 7 additions & 1 deletionpgml-dashboard/src/components/icons/checkmark/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
8 changes: 8 additions & 0 deletionspgml-dashboard/src/components/inputs/mod.rs
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
85 changes: 85 additions & 0 deletionspgml-dashboard/src/components/inputs/range/mod.rs
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,85 @@ | ||
use crate::components::stimulus::StimulusTarget as Target; | ||
use pgml_components::component; | ||
use sailfish::TemplateOnce; | ||
#[derive(Default)] | ||
pub enum InterpolationType { | ||
#[default] | ||
Linear, | ||
Exponential, | ||
} | ||
impl ToString for InterpolationType { | ||
fn to_string(&self) -> String { | ||
match self { | ||
InterpolationType::Linear => String::from("linear"), | ||
InterpolationType::Exponential => String::from("exponential"), | ||
} | ||
} | ||
} | ||
impl From<&str> for InterpolationType { | ||
fn from(s: &str) -> Self { | ||
match s { | ||
"linear" => InterpolationType::Linear, | ||
"exponential" => InterpolationType::Exponential, | ||
_ => InterpolationType::Linear, | ||
} | ||
} | ||
} | ||
#[derive(TemplateOnce, Default)] | ||
#[template(path = "inputs/range/template.html")] | ||
pub struct Range { | ||
color: String, | ||
min: i32, | ||
max: i32, | ||
interpolation_type: InterpolationType, | ||
target: Target, | ||
initial_value: i32, | ||
} | ||
impl Range { | ||
pub fn new() -> Range { | ||
Range { | ||
color: String::from("slate"), | ||
min: 1000, | ||
max: 1000000, | ||
interpolation_type: InterpolationType::Linear, | ||
target: Target::new(), | ||
initial_value: 0, | ||
} | ||
} | ||
pub fn color(mut self, color: &str) -> Self { | ||
self.color = color.to_string(); | ||
self | ||
} | ||
pub fn min(mut self, min: i32) -> Self { | ||
self.min = min; | ||
self | ||
} | ||
pub fn max(mut self, max: i32) -> Self { | ||
self.max = max; | ||
self | ||
} | ||
pub fn interpolation_type(mut self, interpolation_type: &str) -> Self { | ||
self.interpolation_type = InterpolationType::from(interpolation_type); | ||
self | ||
} | ||
pub fn target(mut self, target: Target) -> Self { | ||
self.target = target; | ||
self | ||
} | ||
pub fn initial_value(mut self, initial_value: i32) -> Self { | ||
self.initial_value = initial_value; | ||
self | ||
} | ||
} | ||
component!(Range); |
56 changes: 56 additions & 0 deletionspgml-dashboard/src/components/inputs/range/range.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,56 @@ | ||
div[data-controller="inputs-range"] { | ||
// This allows line overhang for rounding range edges. | ||
.overlay-offset { | ||
width: calc(100% - 4px); | ||
margin-left: 2px; | ||
} | ||
.line { | ||
width: 100%; | ||
height: 5px; | ||
position: absolute; | ||
top: 11px; | ||
border-radius: 1rem; | ||
} | ||
.grab-brightness { | ||
filter: brightness(90%) !important; | ||
} | ||
.range-container { | ||
position: relative; | ||
&:hover { | ||
.line { | ||
filter: brightness(110%); | ||
} | ||
.active-color { | ||
filter: brightness(110%); | ||
} | ||
} | ||
} | ||
// Quick resize fix. This may become a global change later. | ||
.input-group { | ||
padding: 8px; | ||
} | ||
@mixin color_dependent($color) { | ||
.line { | ||
background: linear-gradient(to right, #{$color} 5%, #{$form-range-track-color} 5%); | ||
} | ||
.form-range { | ||
& { | ||
color: #{$color}; | ||
} | ||
} | ||
} | ||
.slate { | ||
@include color_dependent($slate-shade-100); | ||
} | ||
.neon { | ||
@include color_dependent($neon-shade-100); | ||
} | ||
} |
91 changes: 91 additions & 0 deletionspgml-dashboard/src/components/inputs/range/range_controller.js
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,91 @@ | ||
import { Controller } from "@hotwired/stimulus"; | ||
export default class extends Controller { | ||
static targets = ["range", "line"]; | ||
static values = { | ||
interpolationType: String, | ||
min: Number, | ||
max: Number, | ||
initial: Number, | ||
}; | ||
static outlets = []; | ||
initialize() {} | ||
connect() { | ||
// console.log("range connected", this.initialValue) | ||
this.rangeTarget.value = | ||
this.interpolationTypeValue === "exponential" | ||
? this.exponentialInterpolationSolveX(this.initialValue) | ||
: this.linearInterpolationSolveX(this.initialValue); | ||
} | ||
onGrab() { | ||
if (this.hasLineTarget) { | ||
this.lineTarget.classList.add("grab-brightness"); | ||
} | ||
} | ||
onRelease() { | ||
if (this.hasLineTarget) { | ||
this.lineTarget.classList.remove("grab-brightness"); | ||
} | ||
} | ||
updateSlider(e) { | ||
this.rangeTarget.value = | ||
this.interpolationTypeValue === "exponential" | ||
? this.exponentialInterpolationSolveX(e.detail) | ||
: this.linearInterpolationSolveX(e.detail); | ||
} | ||
sliderMoved() { | ||
this.dispatch("sliderMoved", { | ||
detail: | ||
this.interpolationTypeValue === "exponential" | ||
? this.exponentialInterpolation(this.rangeTarget.value) | ||
: this.linearInterpolation(this.rangeTarget.value), | ||
}); | ||
} | ||
exponentialInterpolation(value) { | ||
if (value < 1) { | ||
return 0; | ||
} | ||
let minValue = this.minValue > 1 ? this.minValue : 1; | ||
let pow = value / 100; | ||
let out = minValue * Math.pow(this.maxValue / minValue, pow); | ||
return parseInt(Number(out.toPrecision(3))); | ||
} | ||
exponentialInterpolationSolveX(value) { | ||
if (value < 1) { | ||
return this.linearInterpolationSolveX(value); | ||
} | ||
let minValue = this.minValue > 1 ? this.minValue : 1; | ||
let numerator = Math.log(value / minValue); | ||
let denominator = Math.log(this.maxValue / minValue); | ||
let out = (numerator / denominator) * 100; | ||
// console.log(numerator, denominator, out, Number(out.toPrecision(3))) | ||
return parseInt(Number(out.toPrecision(3))); | ||
} | ||
linearInterpolation(value) { | ||
let out = (this.maxValue - this.minValue) * (value / 100) + this.minValue; | ||
return parseInt(Number(out.toPrecision(3))); | ||
} | ||
linearInterpolationSolveX(value) { | ||
// console.log("linear solve x ", value, this.minValue, this.maxValue) | ||
let out = ((value - this.minValue) / (this.maxValue - this.minValue)) * 100; | ||
return parseInt(Number(out.toPrecision(3))); | ||
} | ||
disconnect() {} | ||
} |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.