blob: 5f3cc1d4f81bebf27c0aff3408d63da808ed9f95 (
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
|
---
import type { HTMLAttributes } from 'astro/types';
interface Props extends HTMLAttributes<'section'> {
maxWidth?: 'none' | String
colReverse?: boolean
wrapperClass?: string
wFull?: boolean
hFull?: boolean
scrollSection?: boolean
}
const {
maxWidth = '1080px',
colReverse = true,
wrapperClass = '',
wFull = true,
hFull = false,
scrollSection = true,
...props
} = Astro.props;
const twoColumn = Astro.slots.has('left') || Astro.slots.has('right');
const twoColumnClasses = ` ${maxWidth === 'none' ? 'justify-center' : 'justify-center lg:justify-between'}
${colReverse ? 'flex-col-reverse' : 'flex-col'} lg:flex-row items-center`;
const className = `max-w-[${maxWidth}] ${hFull ? 'min-h-screen' : 'h-auto'} ${wFull ? 'w-full' : `w-[${maxWidth}]`} px-5 xl:px-0 flex gap-x-20 gap-y-4${twoColumn ? twoColumnClasses : ''}${props.class ? ` ${props.class}` : ''}`;
const sectionAttr = {
...(scrollSection ? { 'data-scroll-section': '' } : {}),
};
---
<section {...sectionAttr} class={`w-full outline-none flex justify-center ${wrapperClass ?? ''}`}>
<div class={className} {...props}>
{twoColumn
? (
<div class="flex flex-col items-center text-center w-full md:w-auto md:items-start md:text-left relative">
<slot name="left"></slot>
</div>
<div class="flex flex-col items-center text-center w-full md:w-auto md:items-start md:text-left relative">
<slot name="right"></slot>
</div>
)
: (
<slot></slot>
)}
</div>
</section>
|