summaryrefslogtreecommitdiff
path: root/src/components/widgets/CallToActionImage.astro
blob: 2912d6d10cff9e163594943bb235add2b4a887b1 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
import WidgetWrapper from '~/components/ui/WidgetWrapper.astro';
import type { Widget } from '~/types';
import Headline from '~/components/ui/Headline.astro';
import Image from '~/components/common/Image.astro';

interface Props extends Widget {
  title?: string;
  subtitle?: string;
  tagline?: string;
  image?: {
    src: string;
    alt: string;
    href?: string;
    target?: string;
  };
}

const {
  title = await Astro.slots.render('title'),
  subtitle = await Astro.slots.render('subtitle'),
  tagline = await Astro.slots.render('tagline'),
  image,

  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',
      }}
    />
    {
      image && (
        <div class="flex justify-center mt-6">
          {image.href ? (
            <a 
              href={image.href} 
              target={image.target || '_self'}
              rel={image.target === '_blank' ? 'noopener noreferrer' : ''}
              class="inline-block hover:opacity-80 transition-opacity duration-200"
            >
              <Image 
                src={image.src} 
                alt={image.alt} 
                class="h-16 w-auto"
              />
            </a>
          ) : (
            <Image 
              src={image.src} 
              alt={image.alt} 
              class="h-16 w-auto"
            />
          )}
        </div>
      )
    }
  </div>
</WidgetWrapper>