From 716f34d3de95d881ae3b1675756b37be5e1219e2 Mon Sep 17 00:00:00 2001 From: Frank Goossen Date: Tue, 15 Jul 2025 14:30:47 +0200 Subject: [PATCH 1/4] Introduce embla carousel for team carousel --- libs/ui/package.json | 1 + libs/ui/src/TeamCarousel.astro | 197 +++++++++++++++++---------------- package-lock.json | 6 + 3 files changed, 108 insertions(+), 96 deletions(-) diff --git a/libs/ui/package.json b/libs/ui/package.json index 8b6e75c..50da37d 100644 --- a/libs/ui/package.json +++ b/libs/ui/package.json @@ -14,6 +14,7 @@ "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "astro": "^5.11.1", + "embla-carousel": "^8.6.0", "marked": "^15.0.8", "react": "^18.3.1", "react-dom": "^18.3.1" diff --git a/libs/ui/src/TeamCarousel.astro b/libs/ui/src/TeamCarousel.astro index 487a03a..1d63aba 100644 --- a/libs/ui/src/TeamCarousel.astro +++ b/libs/ui/src/TeamCarousel.astro @@ -2,24 +2,6 @@ import { type Team } from "@xprtz/cms"; const team = Astro.props as Team; const site = import.meta.env.PUBLIC_IMAGES_URL; - -const membersPerSlide = 5; -const totalMembers = team.members.length; -const totalSlides = Math.max(1, Math.ceil(totalMembers / membersPerSlide)); -const slidesMembers = Array.from({ length: totalSlides }).map( - (_, slideIndex) => { - const startIndex = slideIndex * membersPerSlide; - const slideMembers = []; - - for (let i = 0; i < membersPerSlide; i++) { - const memberIndex = (startIndex + i); - if (memberIndex >= totalMembers) break; - slideMembers.push(team.members[memberIndex]); - } - - return slideMembers; - } -); ---
@@ -31,23 +13,18 @@ const slidesMembers = Array.from({ length: totalSlides }).map(

{team.description}

- - +
+
+ + +
+
@@ -98,6 +126,67 @@ const site = import.meta.env.PUBLIC_IMAGES_URL; flex: 0 0 20%; } } + + .embla__controls { + display: flex; + justify-content: center; + gap: 1.2rem; + margin-top: 0.5rem; + } + + .embla__buttons { + display: flex; + gap: 0.6rem; + align-items: center; + } + + .embla__button { + -webkit-tap-highlight-color: rgba(var(--text-high-contrast-rgb-value), 0.5); + -webkit-appearance: none; + appearance: none; + background-color: transparent; + touch-action: manipulation; + display: inline-flex; + text-decoration: none; + cursor: pointer; + border: 0; + padding: 0; + margin: 0; + box-shadow: inset 0 0 0 0.2rem theme("colors.primary.600"); + width: 2.5rem; + height: 2.5rem; + z-index: 1; + border-radius: 50%; + color: theme("colors.primary.600"); + display: flex; + align-items: center; + justify-content: center; + transition: all 0.2s ease-in-out; + } + + .embla__button:disabled { + color: theme("colors.primary.300"); + box-shadow: inset 0 0 0 0.2rem theme("colors.primary.300"); + cursor: not-allowed; + } + + .embla__button:not(:disabled):hover, + .embla__button:not(:disabled):focus-visible { + color: theme("colors.white"); + background-color: theme("colors.primary.600"); + outline: none; + } + + .embla__button:not(:disabled):active { + color: theme("colors.white"); + background-color: theme("colors.primary.700"); + transform: scale(0.96); + } + + .embla__button__svg { + width: 35%; + height: 35%; + } From 31e3a4d36fd3a349bc576b7001f2151c3c800113 Mon Sep 17 00:00:00 2001 From: Frank Goossen Date: Wed, 16 Jul 2025 15:13:52 +0200 Subject: [PATCH 4/4] Use hero icons --- libs/ui/src/TeamCarousel.astro | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/libs/ui/src/TeamCarousel.astro b/libs/ui/src/TeamCarousel.astro index d32ab24..3c32478 100644 --- a/libs/ui/src/TeamCarousel.astro +++ b/libs/ui/src/TeamCarousel.astro @@ -1,5 +1,6 @@ --- import { type Team } from "@xprtz/cms"; +import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/react/20/solid"; const team = Astro.props as Team; const site = import.meta.env.PUBLIC_IMAGES_URL; --- @@ -55,24 +56,14 @@ const site = import.meta.env.PUBLIC_IMAGES_URL; type="button" aria-label="Previous team member" > - - - + @@ -182,9 +173,9 @@ const site = import.meta.env.PUBLIC_IMAGES_URL; transform: scale(0.96); } - .embla__button__svg { - width: 35%; - height: 35%; + .embla__button__icon { + width: 70%; + height: 70%; }