Skip to content

Commit de12524

Browse files
committed
Styling fixes for suggested articles on home page
1 parent efdeeab commit de12524

4 files changed

Lines changed: 60 additions & 52 deletions

File tree

src/components/Carousel/index.astro

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ type BaseProps = {
2626
currentSlug?: string
2727
/** Controls whether navigation wraps around */
2828
navigationMode?: CarouselNavigationMode
29+
/** Whether to show the "Read More" link */
30+
showReadMore: boolean
2931
}
3032
3133
export type Props =
@@ -42,14 +44,15 @@ export type Props =
4244
})
4345
4446
const {
45-
title = 'Featured Content',
47+
title,
4648
titleHref,
4749
limit = 3,
4850
variant = 'featured',
4951
currentSlug,
5052
type,
5153
items: itemsOverride,
5254
navigationMode = 'wrap',
55+
showReadMore = false,
5356
} = Astro.props
5457
5558
const allItems: ItemType[] = itemsOverride
@@ -73,17 +76,19 @@ const carouselId = `carousel-${type}-${variant}-${currentSlug ?? 'all'}`
7376
class="block"
7477
>
7578
<section class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
76-
<header class="text-center mb-6">
77-
<h2 id={`${carouselId}-title`} class="font-bold">
78-
{titleHref ? (
79-
<a href={titleHref} class="hover:text-primary transition-colors duration-200 no-underline">
80-
{title}
81-
</a>
82-
) : (
83-
title
84-
)}
85-
</h2>
86-
</header>
79+
{title && (
80+
<header class="text-center mb-6">
81+
<h2 id={`${carouselId}-title`} class="font-bold">
82+
{titleHref ? (
83+
<a href={titleHref} class="hover:text-primary transition-colors duration-200 no-underline">
84+
{title}
85+
</a>
86+
) : (
87+
title
88+
)}
89+
</h2>
90+
</header>
91+
)}
8792

8893
{/* Embla Carousel */}
8994
<div class="embla relative" role="region" aria-labelledby={`${carouselId}-title`}>
@@ -196,12 +201,39 @@ const carouselId = `carousel-${type}-${variant}-${currentSlug ?? 'all'}`
196201
</button>
197202

198203
{/* Dots Navigation */}
199-
<div
200-
class="embla__dots flex gap-2 justify-center mt-8"
201-
role="group"
202-
aria-label={`${title} slide navigation`}
203-
data-carousel-pagination
204-
/>
204+
<div class="mt-8 grid grid-cols-[1fr_auto_1fr] items-center">
205+
<span aria-hidden="true" />
206+
<span
207+
class="embla__dots flex gap-2 justify-center"
208+
role="group"
209+
aria-label={`${title} slide navigation`}
210+
data-carousel-pagination
211+
/>
212+
213+
{showReadMore ? (
214+
<span class="flex justify-end mr-4">
215+
<a
216+
href="/articles"
217+
class="inline-flex items-center px-6 py-3 bg-content-active text-content-inverse font-semibold rounded-lg hover:bg-content no-underline hover:no-underline transition-all duration-200"
218+
>
219+
Read More Articles
220+
<svg
221+
class="ml-2 w-4 h-4"
222+
fill="none"
223+
stroke="currentColor"
224+
viewBox="0 0 24 24"
225+
aria-hidden="true"
226+
focusable="false"
227+
>
228+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"
229+
></path>
230+
</svg>
231+
</a>
232+
</span>
233+
) : (
234+
<span aria-hidden="true" />
235+
)}
236+
</div>
205237

206238
<p
207239
class="sr-only"

src/components/Home/ReadMore/index.astro

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/components/Home/Skills/index.astro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
* "Technologies and Skills" section for the homepage.
44
* Renders a dark strip with icon + label links for each technology.
55
*/
6-
import { type CollectionEntry } from 'astro:content'
6+
import { getCollection } from 'astro:content'
77
import { Image } from 'astro:assets'
88
import Icon from '@components/Icon/index.astro'
99
1010
export interface Props {
1111
title: string
12-
skills: Array<CollectionEntry<'tags'>>
1312
}
1413
15-
const { title, skills } = Astro.props as Props
14+
const { title } = Astro.props as Props
15+
16+
const skills = await getCollection('tags', ({ data }) => data.isSkill === true)
1617
---
1718

1819
<skills-carousel

src/pages/index.astro

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
import { getCollection } from 'astro:content'
32
import BaseLayout from '@layouts/BaseLayout.astro'
43
import Backstage from '@components/Home/Backstage/index.astro'
54
import Carousel from '@components/Carousel/index.astro'
@@ -13,7 +12,7 @@ import Testimonials from '@components/Testimonials/index.astro'
1312
const pageDescription = 'Webstack Builders, Inc. Home Page'
1413
const pageTitle = 'Web Development & Digital Solutions - Webstack Builders, Inc.'
1514
const sectionClasses = 'container mx-auto px-4 sm:px-6 lg:px-8 py-4 md:py-8 lg:py-12'
16-
const skills = await getCollection('tags', ({ data }) => data.isSkill === true)
15+
1716
---
1817

1918
<BaseLayout description={pageDescription} pageTitle={pageTitle} path={'/'}>
@@ -103,10 +102,10 @@ const skills = await getCollection('tags', ({ data }) => data.isSkill === true)
103102

104103
<!-- Skills/Technologies Preview -->
105104
<section
106-
class:list={[sectionClasses, 'hidden md:block']}
105+
class:list={[sectionClasses, 'hidden md:block -mb-12']}
107106
aria-labelledby="home-technologies-title"
108107
>
109-
<Skills skills={skills} title="Technologies & Expertise" />
108+
<Skills title="Technologies & Expertise" />
110109
</section>
111110

112111
<!-- Latest Articles Section -->
@@ -116,15 +115,16 @@ const skills = await getCollection('tags', ({ data }) => data.isSkill === true)
116115
>
117116
<h2
118117
id="carousel-articles-suggested-all-title"
119-
class="font-sans text-lg font-bold text-primary uppercase tracking-widest mb-4"
118+
class="font-sans text-lg font-bold text-primary uppercase tracking-widest -mb-6"
120119
>
121120
Latest Insights
122121
</h2>
122+
123123
<Carousel
124124
titleHref="/articles"
125125
variant="suggested"
126+
limit={7}
126127
type="articles"
127-
classes="md:px-16"
128128
showReadMore={true}
129129
/>
130130
</section>

0 commit comments

Comments
 (0)