Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 2a5eddd

Browse files
committed
featured guides wip
1 parent a71f623 commit 2a5eddd

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

docs/guides/python/ai-podcast-part-1.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ languages:
66
- python
77
image: /docs/images/guides/ai-podcast/part-1/banner.png
88
image_alt: 'AI Podcast Part 1 Banner'
9+
featured:
10+
image: /docs/images/guides/ai-podcast/part-1/banner.png
11+
image_alt: 'AI Podcast Part 1 Banner'
912
---
1013

1114
# Building AI Workflows: Combining LLMs and Voice Models - Part 1

src/app/guides/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import GuidePage from '@/components/guides/GuidePage'
2+
import GuidesFeatured from '@/components/guides/GuidesFeatured'
23
import {
34
Breadcrumb,
45
BreadcrumbItem,
@@ -64,6 +65,7 @@ export default function GuidesPage() {
6465
</BreadcrumbList>
6566
</Breadcrumb>
6667
<Heading level={1}>Guides</Heading>
68+
<GuidesFeatured />
6769
</div>
6870
<div className="-mx-2 border-t px-4 sm:-mx-6 lg:-mx-8">
6971
<div className="mx-auto max-w-7xl px-4">
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import React from 'react'
2+
import { Heading } from '../ui/heading'
3+
import Link from 'next/link'
4+
import Image from 'next/image'
5+
import { ArrowUpRightIcon } from '@heroicons/react/24/outline'
6+
import { allGuides, Guide } from '@/content'
7+
8+
type RequiredFeaturedGuide = Guide & {
9+
featured: NonNullable<Guide['featured']>
10+
}
11+
12+
const GuidesFeatured: React.FC = ({ take = 3 }: { take?: number }) => {
13+
const featuredGuides = allGuides
14+
.filter((guide): guide is RequiredFeaturedGuide => !!guide.featured)
15+
.sort((a, b) => {
16+
if (a.published_at && b.published_at) {
17+
return a.published_at > b.published_at ? -1 : 1
18+
}
19+
20+
return 0
21+
})
22+
.slice(0, take)
23+
24+
return featuredGuides.length === 0 ? null : (
25+
<div>
26+
<Heading level={2} className="sr-only">
27+
Featured
28+
</Heading>
29+
<div className="mx-auto grid max-w-2xl auto-rows-fr grid-cols-1 gap-4 lg:mx-0 lg:max-w-none lg:grid-cols-3">
30+
{featuredGuides.map((guide) => (
31+
<article
32+
key={guide.slug}
33+
className="group relative isolate flex flex-col justify-end overflow-hidden rounded-lg bg-zinc-900 px-8 pb-8 pt-48"
34+
>
35+
<Image
36+
alt={guide.featured.image_alt}
37+
src={guide.featured.image}
38+
fill
39+
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
40+
priority
41+
className="absolute inset-0 -z-10 h-full w-full object-cover"
42+
/>
43+
<div className="absolute inset-0 -z-10 bg-gradient-to-t from-primary-300/50 via-secondary-400/30 to-primary-500/40 dark:from-primary-700/50 dark:via-secondary-800/40 dark:to-primary-900/50" />
44+
<div className="absolute inset-0 -z-10 rounded-2xl ring-1 ring-inset ring-primary-500/10 dark:ring-primary-900/10" />
45+
46+
<h3 className="mt-3 text-lg/6 font-semibold tracking-wide text-white">
47+
<Link href={`/${guide.slug}`}>
48+
<span className="absolute inset-0" />
49+
{guide.title}
50+
</Link>
51+
</h3>
52+
<p className="mt-1 text-base leading-5 text-white dark:text-muted-foreground">
53+
{guide.description}
54+
</p>
55+
<ArrowUpRightIcon
56+
aria-hidden="true"
57+
className="pointer-events-none absolute right-0 top-0 m-4 size-6 text-white transition-transform group-hover:-translate-y-1 group-hover:translate-x-1 dark:text-primary-light/70"
58+
/>
59+
</article>
60+
))}
61+
</div>
62+
</div>
63+
)
64+
}
65+
66+
export default GuidesFeatured

0 commit comments

Comments
 (0)