From 56d6f6c0ccc1e99c6404631203d547798c16809d Mon Sep 17 00:00:00 2001 From: Sergey Bedritsky Date: Tue, 18 May 2021 13:49:03 +0300 Subject: [PATCH 1/5] feat: init Pricing template --- .prettierignore | 1 + docs/content/templates/pricing.md | 12 +++ .../components/organisms/PreLaunchHero.vue | 87 +++++++++++++++++-- .../components/organisms/PricingBlock.vue | 85 ++++++++++++++++++ .../components/templates/Pricing.vue | 18 ++++ 5 files changed, 196 insertions(+), 7 deletions(-) create mode 100644 .prettierignore create mode 100644 docs/content/templates/pricing.md create mode 100644 src/defaultTheme/components/organisms/PricingBlock.vue create mode 100644 src/defaultTheme/components/templates/Pricing.vue diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..2e1fa2d52 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +*.md \ No newline at end of file diff --git a/docs/content/templates/pricing.md b/docs/content/templates/pricing.md new file mode 100644 index 000000000..31950d39c --- /dev/null +++ b/docs/content/templates/pricing.md @@ -0,0 +1,12 @@ +--- +template: pricing +--- + +:::pricing-block{yml} +plans: + - free: + - price: Not working + - starter + - pro +::: + \ No newline at end of file diff --git a/src/defaultTheme/components/organisms/PreLaunchHero.vue b/src/defaultTheme/components/organisms/PreLaunchHero.vue index 7794ad1a9..529ee3c98 100644 --- a/src/defaultTheme/components/organisms/PreLaunchHero.vue +++ b/src/defaultTheme/components/organisms/PreLaunchHero.vue @@ -3,17 +3,53 @@
🚀 Coming Soon

{{ title }}

{{ description }}

@@ -25,15 +61,52 @@ {{ cta.description }}

diff --git a/src/defaultTheme/components/organisms/PricingBlock.vue b/src/defaultTheme/components/organisms/PricingBlock.vue new file mode 100644 index 000000000..c7edf1b53 --- /dev/null +++ b/src/defaultTheme/components/organisms/PricingBlock.vue @@ -0,0 +1,85 @@ + + + diff --git a/src/defaultTheme/components/templates/Pricing.vue b/src/defaultTheme/components/templates/Pricing.vue new file mode 100644 index 000000000..e5694320b --- /dev/null +++ b/src/defaultTheme/components/templates/Pricing.vue @@ -0,0 +1,18 @@ + + + From 0244ad8d6b990ae1ea0f4fb69a505e6ba819a66a Mon Sep 17 00:00:00 2001 From: Sergey Bedritsky Date: Wed, 19 May 2021 19:05:30 +0300 Subject: [PATCH 2/5] feat: Pricing template --- docs/content/templates/pricing.md | 55 +++- .../components/atoms/icons/IconCheck.vue | 10 +- .../components/organisms/PreLaunchHero.vue | 1 + .../components/organisms/PricingBlock.vue | 255 +++++++++++++----- 4 files changed, 244 insertions(+), 77 deletions(-) diff --git a/docs/content/templates/pricing.md b/docs/content/templates/pricing.md index 31950d39c..b23ae04aa 100644 --- a/docs/content/templates/pricing.md +++ b/docs/content/templates/pricing.md @@ -3,10 +3,57 @@ template: pricing --- :::pricing-block{yml} + plans: - - free: - - price: Not working - - starter - - pro + monthly: + base: true + title: Month + label: Monthly + annual: + title: Year + label: Yearly + preSelected: true + divider: 12 + +tiers: + free: + price: + monthly: 0 + annual: 0 + title: Free + description: Our Free plan description + features: + - Feature One + - Feature Two + starter: + preSelected: true + price: + monthly: 10 + annual: 100 + title: Starter + description: Our Starter plan pretty long multiline description + features: + - All Free Tier features + - Feature Three + - Feature Four + pro: + price: + monthly: 100 + annual: 1000 + title: Pro + description: Our Pro plan description + features: + - All Starter Tier features + - Feature Five + - Feature Six + +meta: + currency: $ + featuresTitle: 'Included features:' + buttonText: Choose plan + preSelectedBadge: Popular + checkoutText: 'Total:' + checkoutButtonText: Checkout + ::: \ No newline at end of file diff --git a/src/defaultTheme/components/atoms/icons/IconCheck.vue b/src/defaultTheme/components/atoms/icons/IconCheck.vue index a3f46bc15..5268b5cfa 100644 --- a/src/defaultTheme/components/atoms/icons/IconCheck.vue +++ b/src/defaultTheme/components/atoms/icons/IconCheck.vue @@ -1,11 +1,5 @@ diff --git a/src/defaultTheme/components/organisms/PreLaunchHero.vue b/src/defaultTheme/components/organisms/PreLaunchHero.vue index 529ee3c98..ef2bc0779 100644 --- a/src/defaultTheme/components/organisms/PreLaunchHero.vue +++ b/src/defaultTheme/components/organisms/PreLaunchHero.vue @@ -106,6 +106,7 @@ bg-primary-500 hover:bg-primary-600 focus:outline-none + select-none " > {{ cta.label }} diff --git a/src/defaultTheme/components/organisms/PricingBlock.vue b/src/defaultTheme/components/organisms/PricingBlock.vue index c7edf1b53..26bf204ac 100644 --- a/src/defaultTheme/components/organisms/PricingBlock.vue +++ b/src/defaultTheme/components/organisms/PricingBlock.vue @@ -1,27 +1,171 @@ @@ -31,55 +175,36 @@ import { defineComponent } from '@nuxtjs/composition-api' export default defineComponent({ props: { plans: { - type: Array, - default: () => [] + type: Object, + default: () => {} + }, + tiers: { + type: Object, + default: () => {} + }, + meta: { + type: Object, + default: () => {} } }, - setup() { - const mock = { - plans: { - monthly: {}, - annual: { - selected: true - } - }, - tiers: { - free: { - price: { - monthly: 0, - annual: 0 - }, - title: 'Free', - description: 'Our Free plan' - }, - starter: { - price: { - monthly: 10, - annual: 100 - }, - title: 'Starter', - description: 'Our Starter plan', - selected: true - }, - pro: { - price: { - monthly: 100, - annual: 1000 - }, - title: 'Pro', - description: 'Our Pro plan' - } - } - } + setup(props) { let selectedPlan = null + let basePlan = null let selectedTier = null - Object.keys(mock.plans).forEach(plan => { - if (mock.plans[plan].selected) selectedPlan = plan + function getBasePricing(tier) { + const price = tier.price[selectedPlan] / props.plans[selectedPlan].divider + return price > 0 ? price.toFixed(2) : 0 + } + Object.keys(props.plans).forEach(plan => { + if (props.plans[plan] && props.plans[plan].preSelected) selectedPlan = plan + }) + Object.keys(props.plans).forEach(plan => { + if (props.plans[plan] && props.plans[plan].base) basePlan = plan }) - Object.keys(mock.tiers).forEach(tier => { - if (mock.tiers[tier].selected) selectedTier = tier + Object.keys(props.tiers).forEach(tier => { + if (props.tiers[tier] && props.tiers[tier].preSelected) selectedTier = tier }) - return { mock, selectedPlan, selectedTier } + return { selectedPlan, selectedTier, getBasePricing, basePlan } } }) From 404d13386c7cf7f686fe128e5f0b3f6377d3c671 Mon Sep 17 00:00:00 2001 From: Sergey Bedritsky Date: Wed, 19 May 2021 19:20:53 +0300 Subject: [PATCH 3/5] fix: improvements --- .../components/organisms/PricingBlock.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/defaultTheme/components/organisms/PricingBlock.vue b/src/defaultTheme/components/organisms/PricingBlock.vue index 26bf204ac..adccec054 100644 --- a/src/defaultTheme/components/organisms/PricingBlock.vue +++ b/src/defaultTheme/components/organisms/PricingBlock.vue @@ -76,17 +76,17 @@
-
+
{{ meta.currency }}
-
+
{{ plans[selectedPlan] && plans[selectedPlan].divider ? getBasePricing(tier) : tier.price[selectedPlan] }}
- /{{ plans[basePlan].title }} + / {{ plans[basePlan].title }}
@@ -138,9 +138,13 @@
-
{{ meta.checkoutText }}
-
- {{ tiers[selectedTier].price[selectedPlan] }}{{ meta.currency }} +
{{ meta.checkoutText }}
+
+
+ {{ meta.currency }} + {{ tiers[selectedTier].price[selectedPlan] }} +
+
/ {{ plans[selectedPlan].title }}
-
-
-
- - {{ meta.preSelectedBadge }} - - -
- {{ tier.title }} -
-
- {{ tier.description }} -
- -
-
- {{ meta.currency }} -
-
- {{ plans[selectedPlan] && plans[selectedPlan].divider ? getBasePricing(tier) : tier.price[selectedPlan] }} -
-
- / {{ plans[basePlan].title }} -
-
- -
-
{{ meta.featuresTitle }}
-
    -
  • - - {{ feature }} -
  • -
-
-
- -
-
-
-
+
@@ -193,22 +97,16 @@ export default defineComponent({ }, setup(props) { let selectedPlan = null - let basePlan = null let selectedTier = null - function getBasePricing(tier) { - const price = tier.price[selectedPlan] / props.plans[selectedPlan].divider - return price > 0 ? price.toFixed(2) : 0 - } + Object.keys(props.plans).forEach(plan => { if (props.plans[plan] && props.plans[plan].preSelected) selectedPlan = plan }) - Object.keys(props.plans).forEach(plan => { - if (props.plans[plan] && props.plans[plan].base) basePlan = plan - }) Object.keys(props.tiers).forEach(tier => { if (props.tiers[tier] && props.tiers[tier].preSelected) selectedTier = tier }) - return { selectedPlan, selectedTier, getBasePricing, basePlan } + + return { selectedPlan, selectedTier } } }) diff --git a/src/defaultTheme/components/organisms/PricingGrid.vue b/src/defaultTheme/components/organisms/PricingGrid.vue new file mode 100644 index 000000000..dff9fbb08 --- /dev/null +++ b/src/defaultTheme/components/organisms/PricingGrid.vue @@ -0,0 +1,149 @@ + + + diff --git a/src/defaultTheme/components/templates/Pricing.vue b/src/defaultTheme/components/templates/Marketing.vue similarity index 85% rename from src/defaultTheme/components/templates/Pricing.vue rename to src/defaultTheme/components/templates/Marketing.vue index e5694320b..c89a5620f 100644 --- a/src/defaultTheme/components/templates/Pricing.vue +++ b/src/defaultTheme/components/templates/Marketing.vue @@ -1,5 +1,5 @@ From 8a6499a366954367a8ae301bc741b30db0c5b251 Mon Sep 17 00:00:00 2001 From: Sergey Bedritsky Date: Fri, 21 May 2021 13:32:28 +0300 Subject: [PATCH 5/5] feat: InfoLabel component --- .../components/atoms/InfoLabel.vue | 32 +++++++++++++++++++ .../components/organisms/PreLaunchHero.vue | 21 +----------- .../components/organisms/PricingGrid.vue | 26 +++------------ 3 files changed, 37 insertions(+), 42 deletions(-) create mode 100644 src/defaultTheme/components/atoms/InfoLabel.vue diff --git a/src/defaultTheme/components/atoms/InfoLabel.vue b/src/defaultTheme/components/atoms/InfoLabel.vue new file mode 100644 index 000000000..d2c1c3462 --- /dev/null +++ b/src/defaultTheme/components/atoms/InfoLabel.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/defaultTheme/components/organisms/PreLaunchHero.vue b/src/defaultTheme/components/organisms/PreLaunchHero.vue index ef2bc0779..e13d470d8 100644 --- a/src/defaultTheme/components/organisms/PreLaunchHero.vue +++ b/src/defaultTheme/components/organisms/PreLaunchHero.vue @@ -2,26 +2,7 @@
- - 🚀 Coming Soon - +

- - {{ meta.preSelectedBadge }} - + :label="meta.preSelectedBadge" + class="absolute top-0 left-1/2 transform -translate-x-1/2 -translate-y-1/2" + />
{{ tier.title }}