-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af04c03
commit 8453f34
Showing
6 changed files
with
21 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,27 @@ | ||
<script lang="ts"> | ||
import { inview, type Options, type ObserverEventDetails } from "svelte-inview"; | ||
import { fly } from "svelte/transition"; | ||
const { avatar, name, github }: { avatar: string; name: string; github?: string } = $props(); | ||
let isInView = $state(false); | ||
const animDelay = Math.random() * 200; | ||
const inviewOpts: Options = { | ||
unobserveOnEnter: true, | ||
rootMargin: "-20%", | ||
}; | ||
const inviewChange = ({ detail }: CustomEvent<ObserverEventDetails>) => { | ||
isInView = detail.inView; | ||
}; | ||
</script> | ||
|
||
{#if github} | ||
<div | ||
class="flex flex-col items-center justify-center" | ||
use:inview={inviewOpts} | ||
oninview_change={inviewChange} | ||
<a | ||
in:fly={{ x: 20, delay: animDelay }} | ||
href="https://github.com/{github}" | ||
target="_blank" | ||
class="flex flex-col items-center justify-start bg-slate-9 py-4 w-full rounded-lg transition-all hover:scale-110 hover:bg-slate-8 cursor-pointer decoration-none color-white" | ||
> | ||
{#if isInView} | ||
<a | ||
in:fly={{ x: 20, delay: animDelay }} | ||
href="https://github.com/{github}" | ||
target="_blank" | ||
class="flex flex-col items-center justify-start bg-slate-9 py-4 w-full h-full rounded-lg transition-all hover:scale-110 hover:bg-slate-8 cursor-pointer decoration-none color-white" | ||
> | ||
<img class="w-60 rounded-lg h-60 object-cover object-top" src={avatar} alt={name} /> | ||
<p class="text-lg font-bold mb-0">{name}</p> | ||
<p class="mt-0 color-blue-3">@{github}</p> | ||
</a> | ||
{:else} | ||
<div class="w-full h-full"></div> | ||
{/if} | ||
</div> | ||
<img class="w-60 rounded-lg h-60 object-cover object-top" src={avatar} alt={name} /> | ||
<p class="text-lg font-bold mb-0">{name}</p> | ||
<p class="mt-0 color-blue-3">@{github}</p> | ||
</a> | ||
{:else} | ||
<div | ||
class="flex flex-col items-center justify-center" | ||
use:inview={inviewOpts} | ||
oninview_change={inviewChange} | ||
in:fly={{ x: 20, delay: animDelay }} | ||
class="w-full flex flex-col items-center justify-start bg-slate-9 py-4 rounded-lg decoration-none color-white" | ||
> | ||
{#if isInView} | ||
<div | ||
in:fly={{ x: 20, delay: animDelay }} | ||
class="w-full h-full flex flex-col items-center justify-start bg-slate-9 py-4 rounded-lg decoration-none color-white" | ||
> | ||
<img class="w-60 rounded-lg h-60 object-cover object-top" src={avatar} alt={name} /> | ||
<p class="text-lg font-bold mb-0">{name}</p> | ||
</div> | ||
{:else} | ||
<div class="w-full h-full"></div> | ||
{/if} | ||
<img class="w-60 rounded-lg h-60 object-cover object-top" src={avatar} alt={name} /> | ||
<p class="text-lg font-bold mb-0">{name}</p> | ||
</div> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters