From f99c85834d3c4cc2642da91326072b149dcb8a11 Mon Sep 17 00:00:00 2001 From: prototypa Date: Sun, 22 Jan 2023 02:37:15 -0500 Subject: [PATCH] Create Hero2 widget --- src/components/widgets/Hero2.astro | 110 +++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 src/components/widgets/Hero2.astro diff --git a/src/components/widgets/Hero2.astro b/src/components/widgets/Hero2.astro new file mode 100644 index 0000000..bd9d70a --- /dev/null +++ b/src/components/widgets/Hero2.astro @@ -0,0 +1,110 @@ +--- +import { Icon } from 'astro-icon'; +import { Picture } from '@astrojs/image/components'; + +interface CallToAction { + text: string; + href: string; + icon?: string; +} + +export interface Props { + title?: string; + subtitle?: string; + callToAction?: string | CallToAction; + callToAction2?: string | CallToAction; + image?: string | any; // TODO: find HTMLElementProps +} + +const { + title = await Astro.slots.render('title'), + subtitle = await Astro.slots.render('subtitle'), + content = await Astro.slots.render('content'), + callToAction = await Astro.slots.render('callToAction'), + callToAction2 = await Astro.slots.render('callToAction2'), + image = await Astro.slots.render('image'), +} = Astro.props; +--- + +
+ +
+
+
+
+ { + title && ( +

+ ) + } +
+ {subtitle &&

} +

+ { + callToAction && ( +
+ {typeof callToAction === 'string' ? ( + + ) : ( + + {callToAction?.icon && ( + <> + {' '} + + )} + {callToAction?.text} + + )} +
+ ) + } + { + callToAction2 && ( +
+ {typeof callToAction2 === 'string' ? ( + + ) : ( + + {callToAction2?.icon && ( + <> + {' '} + + )} + {callToAction2.text} + + )} +
+ ) + } +
+
+ {content && } +

+
+ { + image && ( +
+ {typeof image === 'string' ? ( + + ) : ( + + )} +
+ ) + } +
+
+
+