diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-22 15:08:37 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-22 15:08:37 +0300 |
| commit | fcc2f4704e39b0e69b377cc138f75027721dac22 (patch) | |
| tree | 732fc94b354a26c08fba9cc9059f9c6c900182be /src/components/ui/WidgetWrapper.astro | |
Initial template
Diffstat (limited to 'src/components/ui/WidgetWrapper.astro')
| -rw-r--r-- | src/components/ui/WidgetWrapper.astro | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/components/ui/WidgetWrapper.astro b/src/components/ui/WidgetWrapper.astro new file mode 100644 index 0000000..c42c751 --- /dev/null +++ b/src/components/ui/WidgetWrapper.astro @@ -0,0 +1,34 @@ +--- +import type { HTMLTag } from 'astro/types'; +import type { Widget } from '~/types'; +import { twMerge } from 'tailwind-merge'; +import Background from './Background.astro'; + +export interface Props extends Widget { + containerClass?: string; + ['as']?: HTMLTag; +} + +const { id, isDark = false, containerClass = '', bg, as = 'section' } = Astro.props; + +const WrapperTag = as; +--- + +<WrapperTag class="relative not-prose scroll-mt-[72px]" {...id ? { id } : {}}> + <div class="absolute inset-0 pointer-events-none -z-[1]" aria-hidden="true"> + <slot name="bg"> + {bg ? <Fragment set:html={bg} /> : <Background isDark={isDark} />} + </slot> + </div> + <div + class:list={[ + twMerge( + 'relative mx-auto max-w-7xl px-4 md:px-6 py-12 md:py-16 lg:py-20 text-default intersect-once intersect-quarter intercept-no-queue motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade', + containerClass + ), + { dark: isDark }, + ]} + > + <slot /> + </div> +</WrapperTag> |
