2026-05-09 06:05:03 +01:00
|
|
|
|
<script lang="ts">
|
|
|
|
|
|
import ArrowUpRightIcon from '@lucide/svelte/icons/arrow-up-right';
|
2026-05-18 03:47:22 +01:00
|
|
|
|
import { DotField } from '../animation/dot-field';
|
|
|
|
|
|
import { Waves } from '../animation/waves';
|
2026-05-09 06:05:03 +01:00
|
|
|
|
import { cn } from '../../tools';
|
2026-05-18 03:47:22 +01:00
|
|
|
|
import type { PublicCourseCalloutAnimation, PublicCourseCalloutData } from './types';
|
2026-05-09 06:05:03 +01:00
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
|
callout: PublicCourseCalloutData | null;
|
|
|
|
|
|
/** "inline" sits below the lesson body; "full" replaces it for locked items. */
|
|
|
|
|
|
variant?: 'inline' | 'full';
|
|
|
|
|
|
/** Shown when callout is null and variant === 'full'. */
|
|
|
|
|
|
lockedFallbackTitle?: string;
|
|
|
|
|
|
lockedFallbackDescription?: string;
|
2026-05-18 03:47:22 +01:00
|
|
|
|
animation?: PublicCourseCalloutAnimation;
|
2026-05-09 06:05:03 +01:00
|
|
|
|
class?: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let {
|
|
|
|
|
|
callout,
|
|
|
|
|
|
variant = 'inline',
|
|
|
|
|
|
lockedFallbackTitle = 'This lesson is locked',
|
|
|
|
|
|
lockedFallbackDescription = 'The creator hasn’t shared a link for this lesson yet. Check back later.',
|
2026-05-18 03:47:22 +01:00
|
|
|
|
animation = 'waves',
|
2026-05-09 06:05:03 +01:00
|
|
|
|
class: className
|
|
|
|
|
|
}: Props = $props();
|
|
|
|
|
|
|
2026-05-18 03:47:22 +01:00
|
|
|
|
const motionClass = 'ui:pointer-events-none ui:absolute ui:inset-0 ui:z-0 ui:h-full ui:w-full';
|
|
|
|
|
|
|
|
|
|
|
|
const cardBase = 'ui:rounded-xl ui:border ui:border-primary/50 ui:text-card-foreground ui:transition-colors';
|
2026-05-09 06:05:03 +01:00
|
|
|
|
|
|
|
|
|
|
const rootClass = $derived(
|
|
|
|
|
|
variant === 'full'
|
|
|
|
|
|
? cn(
|
|
|
|
|
|
cardBase,
|
2026-05-18 03:47:22 +01:00
|
|
|
|
'ui:relative ui:overflow-hidden ui:my-10 ui:mx-auto ui:w-full ui:h-full ui:max-w-4xl ui:max-h-4xl ui:p-8 ui:flex ui:flex-col ui:items-center ui:justify-center ui:border-2 ui:border-primary/50 ui:border-dashed',
|
2026-05-09 06:05:03 +01:00
|
|
|
|
className
|
|
|
|
|
|
)
|
2026-05-18 03:47:22 +01:00
|
|
|
|
: cn(cardBase, 'ui:relative ui:overflow-hidden ui:mt-10 ui:p-6', className)
|
2026-05-09 06:05:03 +01:00
|
|
|
|
);
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
2026-05-18 03:47:22 +01:00
|
|
|
|
{#snippet calloutMotionBackground()}
|
|
|
|
|
|
{#if animation === 'waves'}
|
|
|
|
|
|
<Waves class={motionClass} />
|
|
|
|
|
|
{:else if animation === 'dotted'}
|
|
|
|
|
|
<DotField
|
|
|
|
|
|
dotRadius={1.5}
|
|
|
|
|
|
dotSpacing={14}
|
|
|
|
|
|
cursorRadius={420}
|
|
|
|
|
|
bulgeOnly={true}
|
|
|
|
|
|
bulgeStrength={56}
|
|
|
|
|
|
glowRadius={140}
|
|
|
|
|
|
sparkle={false}
|
|
|
|
|
|
waveAmplitude={0}
|
|
|
|
|
|
maxGlowOpacity={0.5}
|
|
|
|
|
|
class={motionClass}
|
|
|
|
|
|
/>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
{/snippet}
|
|
|
|
|
|
|
2026-05-09 06:05:03 +01:00
|
|
|
|
{#if callout}
|
|
|
|
|
|
<aside class={rootClass}>
|
2026-05-18 03:47:22 +01:00
|
|
|
|
{@render calloutMotionBackground()}
|
|
|
|
|
|
<div class="ui:relative ui:z-10 ui:flex ui:flex-col ui:items-center">
|
|
|
|
|
|
<h3 class={cn('', variant === 'full' ? 'ui:text-3xl' : 'ui:text-xl')}>
|
|
|
|
|
|
{callout.title}
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
<p
|
|
|
|
|
|
class={cn(
|
|
|
|
|
|
'ui:mt-2 ui:text-md ui:text-muted-foreground ui:text-center',
|
|
|
|
|
|
variant === 'full' && 'ui:mx-auto ui:max-w-md'
|
|
|
|
|
|
)}
|
|
|
|
|
|
>
|
|
|
|
|
|
{callout.description}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<a
|
|
|
|
|
|
href={callout.buttonUrl}
|
|
|
|
|
|
target="_blank"
|
|
|
|
|
|
rel="noopener"
|
|
|
|
|
|
class={cn(
|
|
|
|
|
|
'ui:mt-4 ui:inline-flex ui:items-center ui:gap-1.5 ui:rounded-md ui:bg-primary ui:px-4 ui:py-2 ui:text-sm ui:font-medium ui:text-primary-foreground ui:transition-colors ui:hover:bg-primary/90'
|
|
|
|
|
|
)}
|
|
|
|
|
|
>
|
|
|
|
|
|
{callout.buttonLabel}
|
|
|
|
|
|
<ArrowUpRightIcon class="ui:size-4 custom" />
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</div>
|
2026-05-09 06:05:03 +01:00
|
|
|
|
</aside>
|
|
|
|
|
|
{:else if variant === 'full'}
|
|
|
|
|
|
<aside class={rootClass}>
|
2026-05-18 03:47:22 +01:00
|
|
|
|
{@render calloutMotionBackground()}
|
|
|
|
|
|
<div class="ui:relative ui:z-10">
|
|
|
|
|
|
<h3 class="ui:text-xl ui:font-semibold ui:text-foreground">{lockedFallbackTitle}</h3>
|
|
|
|
|
|
<p class="ui:mt-2 ui:mx-auto ui:max-w-md ui:text-sm ui:text-muted-foreground">{lockedFallbackDescription}</p>
|
|
|
|
|
|
</div>
|
2026-05-09 06:05:03 +01:00
|
|
|
|
</aside>
|
|
|
|
|
|
{/if}
|