2024-02-18 00:55:43 +04:00
|
|
|
---
|
|
|
|
// Import section components
|
2024-03-27 17:25:34 -05:00
|
|
|
import { SITE } from "@/data_files/constants";
|
2024-03-25 22:39:36 +04:00
|
|
|
import MainLayout from "@/layouts/MainLayout.astro";
|
2024-02-18 00:55:43 +04:00
|
|
|
import { Image } from "astro:assets";
|
|
|
|
import { getCollection } from "astro:content";
|
|
|
|
|
2024-02-18 07:39:17 +04:00
|
|
|
// Use `getStaticPaths` to generate static routes for generated pages on build
|
2024-02-18 00:55:43 +04:00
|
|
|
export async function getStaticPaths() {
|
|
|
|
const insightPosts = await getCollection("insights");
|
|
|
|
return insightPosts.map((post) => ({
|
|
|
|
params: { slug: post.slug },
|
|
|
|
props: { post },
|
|
|
|
}));
|
|
|
|
}
|
2024-04-02 01:44:15 +04:00
|
|
|
|
2024-02-18 07:39:17 +04:00
|
|
|
// Get the props for this page that define a specific insight post
|
2024-02-18 00:55:43 +04:00
|
|
|
const { post } = Astro.props;
|
2024-03-27 17:25:34 -05:00
|
|
|
|
2024-04-02 01:44:15 +04:00
|
|
|
const { Content } = await post.render();
|
|
|
|
|
2024-03-27 17:25:34 -05:00
|
|
|
const pageTitle: string = `${post.data.title} | ${SITE.title}`;
|
2024-02-18 00:55:43 +04:00
|
|
|
---
|
|
|
|
|
2024-04-02 01:44:15 +04:00
|
|
|
<MainLayout title={pageTitle}>
|
2024-02-19 09:36:37 +04:00
|
|
|
<section class="py-6 sm:py-8 lg:py-12">
|
2024-02-18 00:55:43 +04:00
|
|
|
<div class="mx-auto max-w-screen-xl px-4 md:px-8">
|
|
|
|
<div class="grid gap-8 md:grid-cols-2 lg:gap-12">
|
|
|
|
<div>
|
|
|
|
<div class="h-64 overflow-hidden rounded-lg shadow-lg md:h-auto">
|
|
|
|
<Image
|
2024-02-18 07:39:17 +04:00
|
|
|
class="h-full w-full object-cover object-center"
|
|
|
|
src={post.data.cardImage}
|
|
|
|
alt={post.data.cardImageAlt}
|
|
|
|
draggable={"false"}
|
|
|
|
format={"avif"}
|
|
|
|
/>
|
2024-02-18 00:55:43 +04:00
|
|
|
</div>
|
2024-04-02 01:44:15 +04:00
|
|
|
<div id="pin" class="mt-10">
|
|
|
|
<div class="mb-4 h-0.5 w-full bg-[#fa5a15]" id="progress"></div>
|
|
|
|
<h2 class="text-pretty text-sm font-light text-neutral-500">
|
|
|
|
Table of Contents:
|
|
|
|
</h2>
|
|
|
|
</div>
|
2024-02-18 00:55:43 +04:00
|
|
|
</div>
|
2024-02-18 07:39:17 +04:00
|
|
|
|
2024-02-18 00:55:43 +04:00
|
|
|
<div class="md:pt-8">
|
2024-02-18 07:39:17 +04:00
|
|
|
<h1
|
|
|
|
class="mb-4 text-balance text-center text-2xl font-bold text-neutral-800 dark:text-neutral-200 sm:text-3xl md:mb-6 md:text-left"
|
|
|
|
>
|
|
|
|
{post.data.title}
|
|
|
|
</h1>
|
2024-04-02 01:44:15 +04:00
|
|
|
|
|
|
|
<article
|
|
|
|
class="text-pretty text-lg text-neutral-700 dark:text-neutral-300"
|
|
|
|
>
|
|
|
|
<Content />
|
|
|
|
</article>
|
2024-02-18 07:39:17 +04:00
|
|
|
</div>
|
2024-02-18 00:55:43 +04:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-02-19 09:36:37 +04:00
|
|
|
</section>
|
2024-02-18 00:55:43 +04:00
|
|
|
</MainLayout>
|
2024-04-02 01:44:15 +04:00
|
|
|
|
|
|
|
<style is:global>
|
|
|
|
h2,
|
|
|
|
h3,
|
|
|
|
h4,
|
|
|
|
h5,
|
|
|
|
h6 {
|
|
|
|
font-weight: bold;
|
|
|
|
margin-top: 2.5rem;
|
|
|
|
}
|
|
|
|
h2 {
|
|
|
|
font-size: 1.5rem;
|
|
|
|
line-height: 2rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
h3 {
|
|
|
|
font-size: 1.25rem;
|
|
|
|
line-height: 1.75rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
h4 {
|
|
|
|
font-size: 1.125rem;
|
|
|
|
line-height: 1.75rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
p {
|
|
|
|
margin-top: 1.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes grow-progress {
|
|
|
|
from {
|
|
|
|
transform: scaleX(0);
|
|
|
|
}
|
|
|
|
to {
|
|
|
|
transform: scaleX(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#progress {
|
|
|
|
transform-origin: 0 50%;
|
|
|
|
animation: grow-progress auto linear;
|
|
|
|
animation-timeline: scroll(block root);
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { gsap } from "gsap";
|
|
|
|
import { ScrollTrigger } from "gsap/ScrollTrigger";
|
|
|
|
|
|
|
|
gsap.registerPlugin(ScrollTrigger);
|
|
|
|
|
|
|
|
gsap.timeline({
|
|
|
|
scrollTrigger: {
|
|
|
|
scrub: 1,
|
|
|
|
pin: true,
|
|
|
|
trigger: "#pin",
|
|
|
|
markers: true,
|
|
|
|
start: "top 20%",
|
|
|
|
endTrigger: "footer",
|
|
|
|
end: "top bottom",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|