Skip to content

Commit 2a51618

Browse files
committed
Pick center story demo
1 parent abfe76a commit 2a51618

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

docs/app/(home)/page.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useState } from "react";
3+
import { useState, useEffect, useRef } from "react";
44
import Link from "next/link";
55
import {
66
Server,
@@ -340,11 +340,21 @@ const demos = [
340340
];
341341

342342
function DemoGallery() {
343+
const chatRef = useRef<HTMLDivElement>(null);
344+
345+
useEffect(() => {
346+
chatRef.current?.scrollIntoView({ inline: "center", block: "nearest" });
347+
}, []);
348+
343349
return (
344350
<div className="flex snap-x snap-mandatory gap-6 overflow-x-auto pb-4">
345351
<div className="w-[15%] shrink-0" aria-hidden="true" />
346352
{demos.map((demo) => (
347-
<div key={demo.id} className="w-[70%] shrink-0 snap-center">
353+
<div
354+
key={demo.id}
355+
ref={demo.id === "chat" ? chatRef : undefined}
356+
className="w-[70%] shrink-0 snap-center"
357+
>
348358
<h3 className="mb-1 text-lg font-semibold">{demo.title}</h3>
349359
<p className="mb-3 text-sm text-fd-muted-foreground">{demo.description}</p>
350360
<div className="overflow-hidden rounded-xl border border-fd-border shadow-lg">

0 commit comments

Comments
 (0)