summaryrefslogtreecommitdiff
path: root/src/components/widgets/CallToAction.astro
blob: f51aa912977d7bd3ba50020aba332d1ae2d8bf7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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>