Shinhati2023 commited on
Commit
ac7cbc6
·
verified ·
1 Parent(s): e622b04

Update pages/index.js

Browse files
Files changed (1) hide show
  1. pages/index.js +9 -7
pages/index.js CHANGED
@@ -2,19 +2,21 @@ import GlassCard from '../components/GlassCard';
2
  import MainLayout from '../layouts/MainLayout';
3
 
4
  export default function Home() {
5
- const posts = [ /* ... your data ... */ ];
 
 
 
 
 
6
 
7
  return (
8
  <MainLayout>
9
- {/* h-[100dvh] = Full Dynamic Viewport Height (ignores browser bars)
10
- overflow-y-scroll = Allows vertical scrolling
11
- snap-y snap-mandatory = Forces the scroll to stop exactly on a card
12
- */}
13
  <div className="h-[100dvh] w-full overflow-y-scroll snap-y snap-mandatory scroll-smooth no-scrollbar">
14
 
15
  {posts.map((post) => (
16
- // Each card wrapper must be full screen and defined as a snap point
17
- <div key={post.id} className="w-full h-[100dvh] snap-start snap-always">
18
  <GlassCard
19
  image={post.image}
20
  caption={post.caption}
 
2
  import MainLayout from '../layouts/MainLayout';
3
 
4
  export default function Home() {
5
+ // Mock Data - Replace with real data later
6
+ const posts = [
7
+ { id: 1, image: "/assets/model1.jpg", caption: "Summer Collection", price: "$45" },
8
+ { id: 2, image: "/assets/model2.jpg", caption: "Urban Fit", price: "$80" },
9
+ { id: 3, image: "/assets/model3.jpg", caption: "Evening Wear", price: "$120" },
10
+ ];
11
 
12
  return (
13
  <MainLayout>
14
+ {/* THE SNAP CONTAINER */}
 
 
 
15
  <div className="h-[100dvh] w-full overflow-y-scroll snap-y snap-mandatory scroll-smooth no-scrollbar">
16
 
17
  {posts.map((post) => (
18
+ // snap-start = Locks the card to the top of the screen
19
+ <div key={post.id} className="w-full h-[100dvh] snap-start flex items-center justify-center p-4">
20
  <GlassCard
21
  image={post.image}
22
  caption={post.caption}