Skip to content

Commit f64e855

Browse files
committed
Add 'showEmblaDots' prop to Carousel component
1 parent 89c4fc1 commit f64e855

3 files changed

Lines changed: 432 additions & 14 deletions

File tree

‎src/components/Carousel/index.astro‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ type BaseProps = {
2828
navigationMode?: CarouselNavigationMode
2929
/** Whether to show the "Read More" link */
3030
showReadMore: boolean
31+
/** Whether to show Embla dots pagination */
32+
showEmblaDots?: boolean
3133
}
3234
3335
export type Props =
@@ -55,6 +57,7 @@ const {
5557
items: itemsOverride,
5658
navigationMode = 'wrap',
5759
showReadMore = false,
60+
showEmblaDots = true,
5861
} = props
5962
6063
const isKnownCollectionSlug = (slug: Props['type']): slug is KnownCollectionSlug => slug !== 'unknown'
@@ -190,12 +193,17 @@ const carouselId = `carousel-${type}-${variant}-${currentSlug ?? 'all'}`
190193
{/* Dots Navigation */}
191194
<div class="mt-8 grid grid-cols-[1fr_auto_1fr] items-center">
192195
<span aria-hidden="true" />
193-
<span
194-
class="embla__dots hidden sm:flex gap-2 justify-center"
195-
role="group"
196-
aria-label={`${title} slide navigation`}
197-
data-carousel-pagination
198-
/>
196+
{/** Renders an aria-hidden placeholder span on false to preserve the 3-column grid layout */}
197+
{showEmblaDots ? (
198+
<span
199+
class="embla__dots hidden sm:flex gap-2 justify-center"
200+
role="group"
201+
aria-label={`${title} slide navigation`}
202+
data-carousel-pagination
203+
/>
204+
) : (
205+
<span aria-hidden="true" />
206+
)}
199207

200208
{showReadMore ? (
201209
<span class="flex justify-end mr-4">

‎src/pages/articles/index.astro‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ for (const tag of tagsWithNoContent) {
2727
}
2828
2929
const pageTitle = 'Technical Index'
30-
const pageDescription = 'Browse documentation and guides structured by specific topics like Kubernetes, developer experience, and release engineering'
31-
const path = '/tags'
30+
const pageDescription = 'Browse documentation and guides structured by specific topics'
31+
const path = '/articles'
3232
---
3333

3434
<PageLayout

0 commit comments

Comments
 (0)