Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add initial view transition #67

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/layouts/default/components/nav-link.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@ const isSelected =
>
<slot />
</span>
{isSelected ? <div class="h-1 bg-wording w-full rounded-lg mt-1.5" /> : null}
{
isSelected ? (
<div
transition:name="nav-link-active-indicator"
class="h-1 bg-wording w-full rounded-lg mt-1.5"
/>
) : null
}
</a>
16 changes: 12 additions & 4 deletions src/layouts/default/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ const canonicalUrl = getCanonicalUrl(Astro.url);
---

<!doctype html>
<html lang="en">
<html lang="en" transition:animate="none">
<head>
<style>
@view-transition {
navigation: auto; /* enabled! */
}
</style>

<script is:inline set:html={getJsText()} />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down Expand Up @@ -49,12 +55,14 @@ const canonicalUrl = getCanonicalUrl(Astro.url);
<title>{title}</title>
</head>
<body>
<main
<section
class="mx-auto flex min-h-full flex-col px-6 py-8 md:max-w-[42rem] md:px-4 md:py-24"
>
<Header class="mb-6" />
<slot />
<main>
<slot />
</main>
<Footer class="mt-auto pt-16" />
</main>
</section>
</body>
</html>
Loading