summaryrefslogtreecommitdiff
path: root/src/components/widgets/CallToAction.astro
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2025-07-21 21:56:55 +0300
committerDawid Rycerz <dawid@rycerz.xyz>2025-07-21 21:56:55 +0300
commitc735556726e75428550a3d28a2cf58e2c8490b7d (patch)
treefd0ae29d1636b825abeedff6b99d3376bb383135 /src/components/widgets/CallToAction.astro
Initial template
Diffstat (limited to 'src/components/widgets/CallToAction.astro')
-rw-r--r--src/components/widgets/CallToAction.astro58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/components/widgets/CallToAction.astro b/src/components/widgets/CallToAction.astro
new file mode 100644
index 0000000..f51aa91
--- /dev/null
+++ b/src/components/widgets/CallToAction.astro
@@ -0,0 +1,58 @@
+---
+import WidgetWrapper from '~/components/ui/WidgetWrapper.astro';
+import type { CallToAction, Widget } from '~/types';
+import Headline from '~/components/ui/Headline.astro';
+import Button from '~/components/ui/Button.astro';
+
+interface Props extends Widget {
+ title?: string;
+ subtitle?: string;
+ tagline?: string;
+ callToAction?: CallToAction;
+ actions?: string | CallToAction[];
+}
+
+const {
+ title = await Astro.slots.render('title'),
+ subtitle = await Astro.slots.render('subtitle'),
+ tagline = await Astro.slots.render('tagline'),
+ actions = await Astro.slots.render('actions'),
+
+ id,
+ isDark = false,
+ classes = {},
+ bg = await Astro.slots.render('bg'),
+} = Astro.props;
+---
+
+<WidgetWrapper id={id} isDark={isDark} containerClass={`max-w-6xl mx-auto ${classes?.container ?? ''}`} bg={bg}>
+ <div
+ class="max-w-3xl mx-auto text-center p-6 rounded-md shadow-xl dark:shadow-none dark:border dark:border-slate-600"
+ >
+ <Headline
+ title={title}
+ subtitle={subtitle}
+ tagline={tagline}
+ classes={{
+ container: 'mb-0 md:mb-0',
+ title: 'text-4xl md:text-4xl font-bold tracking-tighter mb-4 font-heading',
+ subtitle: 'text-xl text-muted dark:text-slate-400',
+ }}
+ />
+ {
+ actions && (
+ <div class="max-w-xs sm:max-w-md m-auto flex flex-nowrap flex-col sm:flex-row sm:justify-center gap-4 mt-6">
+ {Array.isArray(actions) ? (
+ actions.map((action) => (
+ <div class="flex w-full sm:w-auto">
+ <Button {...(action || {})} class="w-full sm:mb-0" />
+ </div>
+ ))
+ ) : (
+ <Fragment set:html={actions} />
+ )}
+ </div>
+ )
+ }
+ </div>
+</WidgetWrapper>