Merge version_4 into main #6
@@ -5,7 +5,7 @@ import ReactLenis from "lenis/react";
|
||||
import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
|
||||
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
|
||||
import { Heart, MessageCircle, Share2, MoreHorizontal } from "lucide-react";
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import { useState, useEffect, useCallback, useRef } from "react";
|
||||
|
||||
const POSTS_DATA = [
|
||||
{ id: "1", author: "Alex J.", content: "Just launched the new version of our platform! So excited to share it with everyone. #tech #launch", likes: 120, comments: 45 },
|
||||
@@ -18,6 +18,7 @@ const POSTS_DATA = [
|
||||
export default function FeedPage() {
|
||||
const [posts, setPosts] = useState(POSTS_DATA);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const lenisRef = useRef<any>(null);
|
||||
|
||||
const loadMore = useCallback(() => {
|
||||
if (loading) return;
|
||||
@@ -28,16 +29,6 @@ export default function FeedPage() {
|
||||
}, 1000);
|
||||
}, [loading]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = () => {
|
||||
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - 500) {
|
||||
loadMore();
|
||||
}
|
||||
};
|
||||
window.addEventListener('scroll', handleScroll);
|
||||
return () => window.removeEventListener('scroll', handleScroll);
|
||||
}, [loadMore]);
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
defaultButtonVariant="directional-hover"
|
||||
@@ -51,7 +42,7 @@ export default function FeedPage() {
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="bold"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<ReactLenis root ref={lenisRef}>
|
||||
<NavbarStyleApple
|
||||
navItems={[
|
||||
{ name: "Home", id: "/" },
|
||||
@@ -63,7 +54,15 @@ export default function FeedPage() {
|
||||
<main className="pt-32 pb-20 px-4 max-w-2xl mx-auto space-y-6">
|
||||
<h1 className="text-4xl font-bold mb-8">Community Feed</h1>
|
||||
{posts.map((post) => (
|
||||
<div key={post.id} className="p-6 rounded-2xl border bg-card shadow-sm hover:shadow-md transition-shadow">
|
||||
<div
|
||||
key={post.id}
|
||||
onClick={() => {
|
||||
const lenis = lenisRef.current?.lenis;
|
||||
if (lenis) lenis.scrollTo(`#post-${post.id}`, { offset: -100 });
|
||||
}}
|
||||
id={`post-${post.id}`}
|
||||
className="p-6 rounded-2xl border bg-card shadow-sm hover:shadow-md transition-shadow cursor-pointer"
|
||||
>
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 rounded-full bg-accent" />
|
||||
|
||||
Reference in New Issue
Block a user