summaryrefslogtreecommitdiff
path: root/src/components/widgets/Content.astro
blob: 694a1985368312f41458e90813cc9e040fb85e39 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
import type { Content as Props } from '~/types';
import Headline from '~/components/ui/Headline.astro';
import WidgetWrapper from '~/components/ui/WidgetWrapper.astro';
import Image from '~/components/common/Image.astro';
import Button from '~/components/ui/Button.astro';
import ItemGrid from '~/components/ui/ItemGrid.astro';

const {
  title = await Astro.slots.render('title'),
  subtitle = await Astro.slots.render('subtitle'),
  tagline,
  content = await Astro.slots.render('content'),
  callToAction,
  items = [],
  columns,
  image = await Astro.slots.render('image'),
  isReversed = false,
  isAfterContent = false,

  id,
  isDark = false,
  classes = {},
  bg = await Astro.slots.render('bg'),
} = Astro.props;
---

<WidgetWrapper
  id={id}
  isDark={isDark}
  containerClass={`max-w-7xl mx-auto ${isAfterContent ? 'pt-0 md:pt-0 lg:pt-0' : ''} ${classes?.container ?? ''}`}
  bg={bg}
>
  <Headline
    title={title}
    subtitle={subtitle}
    tagline={tagline}
    classes={{
      container: 'max-w-xl sm:mx-auto lg:max-w-2xl',
      title: 'text-4xl md:text-5xl font-bold tracking-tighter mb-4 font-heading',
      subtitle: 'max-w-3xl mx-auto sm:text-center text-xl text-muted dark:text-slate-400',
    }}
  />
  <div class="mx-auto max-w-7xl p-4 md:px-8">
    <div class={`md:flex ${isReversed ? 'md:flex-row-reverse' : ''} md:gap-16`}>
      <div class="md:basis-1/2 self-center">
        {content && <div class="mb-12 text-lg dark:text-slate-400" set:html={content} />}

        {
          callToAction && (
            <div class="mt-[-40px] mb-8 text-primary">
              <Button variant="link" {...callToAction} />
            </div>
          )
        }

        <ItemGrid
          items={items}
          columns={columns}
          defaultIcon="tabler:check"
          classes={{
            container: `gap-y-4 md:gap-y-8`,
            panel: 'max-w-none',
            title: 'text-lg font-medium leading-6 dark:text-white ml-2 rtl:ml-0 rtl:mr-2',
            description: 'text-muted dark:text-slate-400 ml-2 rtl:ml-0 rtl:mr-2',
            icon: 'flex h-7 w-7 items-center justify-center rounded-full bg-green-600 dark:bg-green-700 text-gray-50 p-1',
            action: 'text-lg font-medium leading-6 dark:text-white ml-2 rtl:ml-0 rtl:mr-2',
          }}
        />
      </div>
      <div aria-hidden="true" class="mt-10 md:mt-0 md:basis-1/2">
        {
          image && (
            <div class="relative m-auto max-w-4xl">
              {typeof image === 'string' ? (
                <Fragment set:html={image} />
              ) : (
                <Image
                  class="mx-auto w-full rounded-lg bg-gray-500 shadow-lg"
                  width={500}
                  height={500}
                  widths={[400, 768]}
                  sizes="(max-width: 768px) 100vw, 432px"
                  layout="responsive"
                  {...image}
                />
              )}
            </div>
          )
        }
      </div>
    </div>
  </div>
</WidgetWrapper>