diff --git a/apps/www/src/lib/components/docs/examples-nav/examples-nav.svelte b/apps/www/src/lib/components/docs/examples-nav/examples-nav.svelte index 9f9a15203..228e96562 100644 --- a/apps/www/src/lib/components/docs/examples-nav/examples-nav.svelte +++ b/apps/www/src/lib/components/docs/examples-nav/examples-nav.svelte @@ -2,10 +2,17 @@ import { page } from "$app/stores"; import { examples } from "$lib/config/docs"; import { cn } from "$lib/utils"; + import { cubicInOut } from "svelte/easing"; + import { crossfade } from "svelte/transition"; import ExampleCodeLink from "./example-code-link.svelte"; let className: string | undefined | null = undefined; export { className as class }; + + const [send, receive] = crossfade({ + duration: 250, + easing: cubicInOut + });
@@ -16,25 +23,35 @@ {...$$restProps} > {#each examples as example, index (index)} + {@const isActive = + $page.url.pathname.startsWith(example.href) || + ($page.url.pathname === "/" && index === 0)} + - {example.name}{" "} - {#if example.label} - - {example.label} - + {#if isActive} +
{/if} +
+ {example.name}{" "} + {#if example.label} + + {example.label} + + {/if} +
{/each}
diff --git a/apps/www/src/routes/examples/forms/(components)/sidebar-nav.svelte b/apps/www/src/routes/examples/forms/(components)/sidebar-nav.svelte index 2a9b741d2..fe9f24e5b 100644 --- a/apps/www/src/routes/examples/forms/(components)/sidebar-nav.svelte +++ b/apps/www/src/routes/examples/forms/(components)/sidebar-nav.svelte @@ -2,24 +2,42 @@ import { cn } from "@/utils"; import { page } from "$app/stores"; import { Button } from "@/registry/new-york/ui/button"; + import { cubicInOut } from "svelte/easing"; + import { crossfade } from "svelte/transition"; + let className: string | undefined | null = undefined; export let items: { href: string; title: string }[]; export { className as class }; + + const [send, receive] = crossfade({ + duration: 250, + easing: cubicInOut + });