From 15ef9ee3e034eafa60f316b8523fb7fca2c57c8d Mon Sep 17 00:00:00 2001 From: prototypa Date: Thu, 27 Jul 2023 14:51:46 -0400 Subject: [PATCH] Start rearranging and simplifying widgets --- src/components/widgets/Content.astro | 10 +- src/components/widgets/FAQs.astro | 91 +++++---------- src/components/widgets/Features.astro | 102 ++++++---------- src/components/widgets/Features2.astro | 103 +++++++--------- src/components/widgets/Header.astro | 1 + src/components/widgets/Pricing.astro | 98 ++++++++++++++++ src/components/widgets/Stats.astro | 10 +- src/components/widgets/Steps.astro | 75 +++++------- src/components/widgets/Steps2.astro | 8 +- src/pages/index.astro | 155 ++++++++++++------------- src/pages/pricing.astro | 96 ++++++++++++++- 11 files changed, 419 insertions(+), 330 deletions(-) create mode 100644 src/components/widgets/Pricing.astro diff --git a/src/components/widgets/Content.astro b/src/components/widgets/Content.astro index 3993cc7..ec7f878 100644 --- a/src/components/widgets/Content.astro +++ b/src/components/widgets/Content.astro @@ -11,7 +11,7 @@ interface Item { export interface Props { title?: string; subtitle?: string; - highlight?: string; + tagline?: string; content?: string; items?: Array; image?: string | any; // TODO: find HTMLElementProps @@ -22,7 +22,7 @@ export interface Props { const { title = await Astro.slots.render('title'), subtitle = await Astro.slots.render('subtitle'), - highlight, + tagline, content = await Astro.slots.render('content'), items = [], image = await Astro.slots.render('image'), @@ -34,12 +34,12 @@ const {
{ - (title || subtitle || highlight) && ( + (title || subtitle || tagline) && (
- {highlight && ( + {tagline && (

)} {title && ( diff --git a/src/components/widgets/FAQs.astro b/src/components/widgets/FAQs.astro index 7dec748..159beab 100644 --- a/src/components/widgets/FAQs.astro +++ b/src/components/widgets/FAQs.astro @@ -1,66 +1,37 @@ --- -import { Icon } from 'astro-icon/components'; - -interface Item { - question: string; - answer: string; -} - -export interface Props { - title?: string; - subtitle?: string; - highlight?: string; - items: Array>; -} +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 = await Astro.slots.render('title'), - subtitle = await Astro.slots.render('subtitle'), - highlight, + title = "", + subtitle = "", + tagline = "", items = [], -} = Astro.props; + columns = 2, + + id, + isDark = false, + classes = {}, + bg = await Astro.slots.render("bg"), +} = Astro.props as Faqs; --- -

-
- { - (title || subtitle || highlight) && ( -
- {highlight && ( -

- )} - {title && ( -

- )} - {subtitle &&

} -

- ) - } -
-
-
- { - items && - items.map((subitems) => ( -
- {subitems.map(({ question, answer }) => ( -
-

- - {question} -

- {answer &&
} -
- ))} -
- )) - } -
-
-
+ + + + diff --git a/src/components/widgets/Features.astro b/src/components/widgets/Features.astro index 59edd25..46d9bc0 100644 --- a/src/components/widgets/Features.astro +++ b/src/components/widgets/Features.astro @@ -1,71 +1,43 @@ --- -import { Icon } from 'astro-icon/components'; - -interface Item { - title: string; - description: string; - icon?: string; -} - -export interface Props { - title?: string; - subtitle?: string; - highlight?: string; - items: Array>; -} +import WidgetWrapper from "~/components/ui/WidgetWrapper.astro"; +import ItemGrid from "~/components/ui/ItemGrid.astro"; +import Headline from "~/components/ui/Headline.astro"; +import type { Features } from "~/types"; const { - title = await Astro.slots.render('title'), - subtitle = await Astro.slots.render('subtitle'), - highlight, + title = await Astro.slots.render("title"), + subtitle = await Astro.slots.render("subtitle"), + tagline = await Astro.slots.render("tagline"), items = [], -} = Astro.props; + columns = 2, + + id, + isDark = false, + classes = {}, + bg = await Astro.slots.render("bg"), +} = Astro.props as Features; --- -
-
- { - (title || subtitle || highlight) && ( -
- {highlight && ( -

- )} - {title && ( -

- )} - - {subtitle && ( -

- )} -

- ) - } -
- { - items.map((subitems) => ( -
- {subitems.map(({ title, description, icon }) => ( -
-
-
- {icon && } -
-
-
-

{title}

-

-

-
- ))} -
- )) - } -
-
-
+ + + + diff --git a/src/components/widgets/Features2.astro b/src/components/widgets/Features2.astro index 8ab1f4a..68a3807 100644 --- a/src/components/widgets/Features2.astro +++ b/src/components/widgets/Features2.astro @@ -1,69 +1,46 @@ --- -import { Icon } from 'astro-icon/components'; - -interface Item { - title?: string; - description?: string; - icon?: string; -} - -export interface Props { - title?: string; - subtitle?: string; - highlight?: string; - items: Array; -} +import WidgetWrapper from "~/components/ui/WidgetWrapper.astro"; +import Headline from "~/components/ui/Headline.astro"; +import ItemGrid2 from "~/components/ui/ItemGrid2.astro"; +import type { Features } from "~/types"; const { - title = await Astro.slots.render('title'), - subtitle = await Astro.slots.render('subtitle'), - highlight, + title = await Astro.slots.render("title"), + subtitle = await Astro.slots.render("subtitle"), + tagline = await Astro.slots.render("tagline"), items = [], -} = Astro.props; + columns = 3, + + id, + isDark = false, + classes = {}, + bg = await Astro.slots.render("bg"), +} = Astro.props as Features; --- -
- -
-
- { - (title || subtitle || highlight) && ( -
- {highlight && ( -

- )} - {title && ( -

- )} - - {subtitle && ( -

- )} -

- ) - } -
- { - items.map(({ title, description, icon }) => ( -
-
- -
{title}
-
- {description &&

} -

- )) - } -
-
-
-
+ + + + diff --git a/src/components/widgets/Header.astro b/src/components/widgets/Header.astro index ce96c7e..9988db8 100644 --- a/src/components/widgets/Header.astro +++ b/src/components/widgets/Header.astro @@ -16,6 +16,7 @@ interface Link { interface ActionLink extends Link { class?: string; + type?: string; } interface MenuLink extends Link { diff --git a/src/components/widgets/Pricing.astro b/src/components/widgets/Pricing.astro new file mode 100644 index 0000000..aa8cf42 --- /dev/null +++ b/src/components/widgets/Pricing.astro @@ -0,0 +1,98 @@ +--- +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 = "", + prices = [], + + id, + isDark = false, + classes = {}, + bg = await Astro.slots.render("bg"), +} = Astro.props as Pricing; +--- + + + +
+
+ { + prices && + prices.map( + ({ + title, + price, + period, + items, + callToAction, + hasRibbon = false, + ribbonTitle, + }) => ( +
+
+ {hasRibbon && ribbonTitle && ( +
+ + {ribbonTitle} + +
+ )} +
    +
  • + {title} +
  • +
  • + $ + {price} +
  • +
  • + {period} +
  • + {items && + items.map(({ description, icon }) => ( +
  • +
    + {icon && ( + + )} +
    + {description} +
  • + ))} +
+ {callToAction && ( +
+ +
+ )} +
+
+ ) + ) + } +
+
+
diff --git a/src/components/widgets/Stats.astro b/src/components/widgets/Stats.astro index a3f4235..9c1ae16 100644 --- a/src/components/widgets/Stats.astro +++ b/src/components/widgets/Stats.astro @@ -7,25 +7,25 @@ interface Item { export interface Props { title?: string; subtitle?: string; - highlight?: string; + tagline?: string; items?: Array; } const { title = await Astro.slots.render('title'), subtitle = await Astro.slots.render('subtitle'), - highlight, + tagline, items = [], } = Astro.props; ---
{ - (title || subtitle || highlight) && ( + (title || subtitle || tagline) && (
- {highlight && ( + {tagline && (

- {highlight} + {tagline}

)} {title && ( diff --git a/src/components/widgets/Steps.astro b/src/components/widgets/Steps.astro index 60e470d..936f6ac 100644 --- a/src/components/widgets/Steps.astro +++ b/src/components/widgets/Steps.astro @@ -1,58 +1,37 @@ --- -import { Icon } from 'astro-icon/components'; import { Picture } from '@astrojs/image/components'; - -interface Item { - title: string; - description?: string; - icon?: string; -} - -export interface Props { - title?: string; - items: Array; - image?: string | any; // TODO: find HTMLElementProps -} +import WidgetWrapper from "~/components/ui/WidgetWrapper.astro"; +import Timeline from "~/components/ui/Timeline.astro"; +import Headline from "~/components/ui/Headline.astro"; +import type { Steps } from "~/types"; const { - title = await Astro.slots.render('title'), + title = await Astro.slots.render("title"), + subtitle = await Astro.slots.render("subtitle"), + tagline = await Astro.slots.render("tagline"), items = [], - image = await Astro.slots.render('image'), -} = Astro.props; + image = await Astro.slots.render("image"), + isReversed = false, + + id, + isDark = false, + classes = {}, + bg = await Astro.slots.render("bg"), +} = Astro.props as Steps; --- -
-
-
- {title &&

} - { - items && - items.length && - items.map(({ title, description, icon }, index) => ( -
-
-
- {index !== items.length - 1 ? ( -
- {icon && } -
- ) : ( -
- -
- )} -
-
-
-
- {title &&

} - {description &&

} -

-
- )) - } + +
+
+ +
-
+
{ image && (typeof image === 'string' ? ( @@ -71,4 +50,4 @@ const { }
-

+ diff --git a/src/components/widgets/Steps2.astro b/src/components/widgets/Steps2.astro index b93d3d0..f930e71 100644 --- a/src/components/widgets/Steps2.astro +++ b/src/components/widgets/Steps2.astro @@ -11,7 +11,7 @@ interface Item { export interface Props { title?: string; subtitle?: string; - highlight?: string; + tagline?: string; callToAction?: string | CallToAction; items: Array; } @@ -19,7 +19,7 @@ export interface Props { const { title = await Astro.slots.render('title'), subtitle = await Astro.slots.render('subtitle'), - highlight, + tagline, callToAction = await Astro.slots.render('callToAction'), items = [], } = Astro.props; @@ -66,10 +66,10 @@ const {
{ - highlight && ( + tagline && (

) } diff --git a/src/pages/index.astro b/src/pages/index.astro index b9efb44..9640487 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -49,57 +49,54 @@ const meta = { + > + +

+ + @@ -274,42 +275,38 @@ const meta = { diff --git a/src/pages/pricing.astro b/src/pages/pricing.astro index a4bd960..6fb9d10 100644 --- a/src/pages/pricing.astro +++ b/src/pages/pricing.astro @@ -1,11 +1,105 @@ --- import Layout from '~/layouts/PageLayout.astro'; +import Pricing from '~/components/widgets/Pricing.astro'; + const meta = { title: "Pricing", }; --- - Pricing +