diff --git a/components/blocks/ReferencesSlider.tsx b/components/blocks/ReferencesSlider.tsx index 00f9d886b..9e55883b0 100644 --- a/components/blocks/ReferencesSlider.tsx +++ b/components/blocks/ReferencesSlider.tsx @@ -46,7 +46,21 @@ export function ReferencesSlider(props: ReferencesSliderProps) { const scrollLeftRef = React.useRef(0); const isDraggingRef = React.useRef(false); const [isDragging, setIsDragging] = React.useState(false); - + + // Center the first card on mount so it appears in the middle with peek on both sides + React.useEffect(() => { + const el = containerRef.current; + if (!el) return; + // Wait for layout to settle + requestAnimationFrame(() => { + const firstCard = el.querySelector('[data-card]') as HTMLElement | null; + if (!firstCard) return; + const cardCenter = firstCard.offsetLeft + firstCard.offsetWidth / 2; + const containerCenter = el.offsetWidth / 2; + el.scrollLeft = cardCenter - containerCenter; + }); + }, [references.length]); + const badge = props.badge || data?.badge || t('badge'); const title = props.title || data?.title || t('title'); const description = props.description || data?.description || t('description'); @@ -108,9 +122,11 @@ export function ReferencesSlider(props: ReferencesSliderProps) {