From 1db237dd7a4829c212e0797fd023f1ef4d950a5c Mon Sep 17 00:00:00 2001 From: widgeter Date: Wed, 9 Aug 2023 19:30:55 +0200 Subject: [PATCH 1/5] Refactor the Pricing widget --- src/components/widgets/Pricing.astro | 120 ++++++++++------------- src/components/widgets/Steps2.astro | 1 - src/pages/pricing.astro | 138 +++++++++++++-------------- src/types.d.ts | 1 + 4 files changed, 118 insertions(+), 142 deletions(-) diff --git a/src/components/widgets/Pricing.astro b/src/components/widgets/Pricing.astro index aa8cf42..baa35c6 100644 --- a/src/components/widgets/Pricing.astro +++ b/src/components/widgets/Pricing.astro @@ -1,48 +1,33 @@ --- -import { Icon } from "astro-icon/components"; -import CTA from "~/components/ui/CTA.astro"; -import Headline from "~/components/ui/Headline.astro"; -import WidgetWrapper from "~/components/ui/WidgetWrapper.astro"; -import type { Pricing } from "~/types"; +import { Icon } from 'astro-icon/components'; +import CTA from '~/components/ui/CTA.astro'; +import Headline from '~/components/ui/Headline.astro'; +import WidgetWrapper from '~/components/ui/WidgetWrapper.astro'; +import type { Pricing } from '~/types'; const { - title = "", - subtitle = "", - tagline = "", + title = '', + subtitle = '', + tagline = '', prices = [], id, isDark = false, classes = {}, - bg = await Astro.slots.render("bg"), + bg = await Astro.slots.render('bg'), } = Astro.props as Pricing; --- - +
-
+
{ prices && - prices.map( - ({ - title, - price, - period, - items, - callToAction, - hasRibbon = false, - ribbonTitle, - }) => ( -
-
+ prices.map(({ title, subtitle, price, period, items, callToAction, hasRibbon = false, ribbonTitle }) => ( +
+ {price && period && ( +
{hasRibbon && ribbonTitle && (
@@ -50,48 +35,47 @@ const {
)} -
    -
  • - {title} -
  • -
  • - $ - {price} -
  • -
  • - {period} -
  • - {items && - items.map(({ description, icon }) => ( -
  • -
    - {icon && ( - - )} -
    - {description} -
  • - ))} -
+
+ {title && ( +

{title}

+ )} + {subtitle &&

{subtitle}

} +
+
+ $ + {price} +
+ {period} +
+ {items && ( +
    + {items.map( + ({ description, icon }) => + description && ( +
  • +
    + +
    + {description} +
  • + ) + )} +
+ )} +
{callToAction && ( -
- +
+ {typeof callToAction === 'string' ? ( + + ) : ( + callToAction && callToAction.text && callToAction.href && + )}
)}
-
- ) - ) + )} +
+ )) }
diff --git a/src/components/widgets/Steps2.astro b/src/components/widgets/Steps2.astro index 9482ff1..3f300ac 100644 --- a/src/components/widgets/Steps2.astro +++ b/src/components/widgets/Steps2.astro @@ -26,7 +26,6 @@ const { title={title} subtitle={subtitle} tagline={tagline} - callToAction={callToAction} classes={{ container: 'text-center md:text-left mb-4 md:mb-8', title: 'mb-4 text-3xl lg:text-4xl font-bold font-heading', diff --git a/src/pages/pricing.astro b/src/pages/pricing.astro index 7a5bcdd..a55840a 100644 --- a/src/pages/pricing.astro +++ b/src/pages/pricing.astro @@ -1,105 +1,97 @@ --- import Layout from '~/layouts/PageLayout.astro'; - -import Pricing from '~/components/widgets/Pricing.astro'; +import Prices from '~/components/widgets/Pricing.astro'; const metadata = { - title: "Pricing", + title: 'Pricing', }; --- - diff --git a/src/types.d.ts b/src/types.d.ts index 5298748..6ae93e2 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -135,6 +135,7 @@ export interface Item { export interface Price { title?: string; + subtitle?: string; description?: string; price?: number; period?: string; From c7b6e597d556fd6be87f568f516c35208a22589e Mon Sep 17 00:00:00 2001 From: widgeter Date: Thu, 10 Aug 2023 11:03:23 +0200 Subject: [PATCH 2/5] Include Faqs widged on pricing page --- src/components/widgets/FAQs.astro | 26 ++++++++---------- src/pages/pricing.astro | 44 ++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 18 deletions(-) diff --git a/src/components/widgets/FAQs.astro b/src/components/widgets/FAQs.astro index 159beab..dd7ffec 100644 --- a/src/components/widgets/FAQs.astro +++ b/src/components/widgets/FAQs.astro @@ -1,37 +1,33 @@ --- -import Headline from "~/components/ui/Headline.astro"; -import ItemGrid from "~/components/ui/ItemGrid.astro"; -import WidgetWrapper from "~/components/ui/WidgetWrapper.astro"; -import type { Faqs } from "~/types"; +import Headline from '~/components/ui/Headline.astro'; +import ItemGrid from '~/components/ui/ItemGrid.astro'; +import WidgetWrapper from '~/components/ui/WidgetWrapper.astro'; +import type { Faqs } from '~/types'; const { - title = "", - subtitle = "", - tagline = "", + title = '', + subtitle = '', + tagline = '', items = [], columns = 2, id, isDark = false, classes = {}, - bg = await Astro.slots.render("bg"), + bg = await Astro.slots.render('bg'), } = Astro.props as Faqs; --- - + diff --git a/src/pages/pricing.astro b/src/pages/pricing.astro index a55840a..7926cc8 100644 --- a/src/pages/pricing.astro +++ b/src/pages/pricing.astro @@ -1,6 +1,7 @@ --- import Layout from '~/layouts/PageLayout.astro'; import Prices from '~/components/widgets/Pricing.astro'; +import FAQs from '~/components/widgets/FAQs.astro'; const metadata = { title: 'Pricing', @@ -8,6 +9,8 @@ const metadata = { --- + + + + + + From 7a0b780620dc17f554f6a37b81421822939ff108 Mon Sep 17 00:00:00 2001 From: widgeter Date: Thu, 10 Aug 2023 11:46:50 +0200 Subject: [PATCH 3/5] Include Steps widget on pricing page --- src/pages/pricing.astro | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/pages/pricing.astro b/src/pages/pricing.astro index 7926cc8..69af36b 100644 --- a/src/pages/pricing.astro +++ b/src/pages/pricing.astro @@ -2,6 +2,7 @@ import Layout from '~/layouts/PageLayout.astro'; import Prices from '~/components/widgets/Pricing.astro'; import FAQs from '~/components/widgets/FAQs.astro'; +import Steps from '~/components/widgets/Steps.astro'; const metadata = { title: 'Pricing', @@ -98,6 +99,52 @@ const metadata = { ]} /> + + + + Date: Thu, 10 Aug 2023 12:12:36 +0200 Subject: [PATCH 4/5] Include a Features3 widget in pricing page --- src/pages/pricing.astro | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/pages/pricing.astro b/src/pages/pricing.astro index 69af36b..ecfd95b 100644 --- a/src/pages/pricing.astro +++ b/src/pages/pricing.astro @@ -3,6 +3,7 @@ import Layout from '~/layouts/PageLayout.astro'; import Prices from '~/components/widgets/Pricing.astro'; import FAQs from '~/components/widgets/FAQs.astro'; import Steps from '~/components/widgets/Steps.astro'; +import Features3 from '~/components/widgets/Features3.astro'; const metadata = { title: 'Pricing', @@ -99,6 +100,46 @@ const metadata = { ]} /> + + +