show view all button using related consts value (#14)

This commit is contained in:
Troy 2025-01-05 20:25:30 +00:00 committed by GitHub
parent 4079f9e872
commit 5752069ee6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View file

@ -7,7 +7,7 @@
class="text-pretty font-['Outfit_Variable'] text-8xl font-bold md:text-9xl"
>
Digital designer based in the <span
class="animate-gradient-x bg-gradient-to-r from-indigo-500 from-10% via-sky-500 via-30% to-emerald-500 to-90% bg-clip-text font-['Playwrite_CA_Variable'] text-7xl font-light text-transparent md:text-8xl"
class="animate-gradient-x bg-gradient-to-r from-indigo-500 from-10% via-sky-500 via-30% to-emerald-500 to-90% bg-clip-text font-['Playwrite_CA_Variable'] text-7xl font-medium text-transparent md:text-8xl"
>United Kingdom</span
>.
</h1>

View file

@ -6,12 +6,16 @@ import ShowcaseProject from "@components/ShowcaseProject.astro";
import ShowcasePost from "@components/ShowcasePost.astro";
import Hero from "@components/Hero.astro";
const posts = (await getCollection("posts"))
const allPosts = await getCollection("posts");
const posts = allPosts
.filter((post) => !post.data.draft)
.sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf())
.slice(0, HOME.HOMESETTINGS?.NUM_POSTS_ON_HOMEPAGE);
const projects = (await getCollection("projects"))
const allProjects = await getCollection("projects");
const projects = allProjects
.filter((project) => !project.data.draft && project.data.featured)
.sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf())
.slice(0, HOME.HOMESETTINGS?.NUM_PROJECTS_ON_HOMEPAGE);
@ -36,9 +40,8 @@ const projects = (await getCollection("projects"))
{projects.map((project) => <ShowcaseProject collection={project} />)}
</ol>
{
projects.length > 1 ? (
allProjects.length > HOME.HOMESETTINGS!.NUM_PROJECTS_ON_HOMEPAGE ? (
<a href="/projects">
{" "}
<div class="mt-8 flex animate-reveal flex-row items-center gap-1 justify-self-center rounded-full bg-tertiary px-3 py-2 font-medium capitalize text-primary opacity-0 transition-colors duration-300 [animation-delay:0.1s] hover:bg-accent">
View all
</div>
@ -63,7 +66,7 @@ const projects = (await getCollection("projects"))
{posts.map((post) => <ShowcasePost collection={post} />)}
</ol>
{
posts.length > 1 ? (
allPosts.length > HOME.HOMESETTINGS!.NUM_POSTS_ON_HOMEPAGE ? (
<a href="/posts">
{" "}
<div class="mt-8 flex animate-reveal flex-row items-center gap-1 justify-self-center rounded-full bg-tertiary px-3 py-2 font-medium capitalize text-primary opacity-0 transition-colors duration-300 [animation-delay:0.1s] hover:bg-accent">