Skip to content

Commit 913944d

Browse files
committed
feat: add view transitions
1 parent b611d51 commit 913944d

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/layouts/Layout.astro

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import { ViewTransitions } from "astro:transitions";
23
import Header from "../components/Header.astro";
34
import Footer from "../components/Footer.astro";
45
@@ -19,6 +20,7 @@ const { title, description } = Astro.props;
1920
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
2021
<meta name="generator" content={Astro.generator} />
2122
<title>{title}</title>
23+
<ViewTransitions />
2224
</head>
2325
<body
2426
class="bg-slate-900 leading-relaxed text-slate-400 antialiased selection:bg-teal-300 selection:text-teal-900 mx-auto min-h-screen max-w-screen-xl px-6 py-12 md:px-12 md:py-20 lg:px-24 lg:py-0 lg:flex lg:justify-between lg:gap-4"
@@ -30,16 +32,16 @@ const { title, description } = Astro.props;
3032
<slot />
3133
<Footer />
3234
</main>
35+
<style is:global>
36+
@tailwind base;
37+
@tailwind components;
38+
@tailwind utilities;
39+
40+
@layer base {
41+
html {
42+
@apply bg-slate-900 text-slate-400 font-sans;
43+
}
44+
}
45+
</style>
3346
</body>
3447
</html>
35-
<style is:global>
36-
@tailwind base;
37-
@tailwind components;
38-
@tailwind utilities;
39-
40-
@layer base {
41-
html {
42-
@apply bg-slate-900 text-slate-400 font-sans;
43-
}
44-
}
45-
</style>

src/pages/blog.astro

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const metadata = {
55
title: "The Lucas Machado Blog",
66
description: "Lucas Machado's personal blog.",
77
};
8+
9+
const postList = await Astro.glob("../pages/blog/*.md");
810
---
911

1012
<Layout {...metadata}>
@@ -20,9 +22,13 @@ const metadata = {
2022
Posts
2123
</h2>
2224
<ul>
23-
<li>
24-
<a href="/blog/why-astro">Why Astro?</a>
25-
</li>
25+
{
26+
postList.map((post) => (
27+
<li>
28+
<a href={post.url}>{post.frontmatter.title}</a>
29+
</li>
30+
))
31+
}
2632
</ul>
2733
</div>
2834
</div>

0 commit comments

Comments
 (0)