Skip to content

Commit b8262b1

Browse files
podcast reveal
1 parent 633d283 commit b8262b1

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

apps/codingcatdev/src/routes/(home-partials)/(home-podcast)/HomePodcast.svelte

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<script lang="ts">
2+
import { inView } from '$lib/actions/inView';
23
import type { Podcast } from '$lib/types';
4+
import { fly } from 'svelte/transition';
35
import GitLineGradient from '../(home-campaign)/GitLineGradient.svelte';
46
import PodcastCard from './PodcastCard.svelte';
57
import PodcastSvg from './PodcastSvg.svelte';
68
export let podcasts: Podcast[];
9+
let visible = false;
710
</script>
811

912
<section class="bg-surface-800-100-token text-surface-100-800-token relative">
@@ -14,7 +17,12 @@
1417
<PodcastSvg />
1518
<GitLineGradient rotate={true} />
1619
</div>
17-
<div class="basis-11/12 pl-4 sm:pl-2 pt-8 sm:pt-20 pb-96 lg:mb-72">
20+
<div
21+
class="basis-11/12 pl-4 sm:pl-2 pt-8 sm:pt-20 pb-96 lg:mb-72"
22+
use:inView
23+
on:enter={() => (visible = true)}
24+
on:exit={() => (visible = false)}
25+
>
1826
<div class="flex flex-col lg:flex-row gap-8 items-center">
1927
<div class="sm:basis-2/3 flex flex-col justify-center gap-8">
2028
<h2>CodingCat.dev Podcast</h2>
@@ -37,7 +45,15 @@
3745
class="snap-x scroll-px-4 snap-mandatory scroll-smooth flex gap-4 overflow-x-auto overflow-y-hidden py-10 sm:justify-center"
3846
>
3947
{#each podcasts as content, i}
40-
<PodcastCard position={i % 2 ? 'left' : 'right'} {content} />
48+
{#if visible}
49+
<div
50+
class="flex flex-none"
51+
in:fly={{ x: 200, delay: 300 * (i + 1), duration: 300 }}
52+
out:fly
53+
>
54+
<PodcastCard position={i % 2 ? 'left' : 'right'} {content} />
55+
</div>
56+
{/if}
4157
{/each}
4258
</div>
4359
</div>

0 commit comments

Comments
 (0)