Build a demo of friend feed posts. Each post can have multiple photos/videos. User can…
- User
Build a demo of friend feed posts. Each post can have multiple photos/videos. User can like the post or react with an emoji (select from the most popular 10 or 20 emojis). User can also comment on a post or reply to a comment. A comment can also get likes/reactions.
Make the feed modern and easy to use.
Assistant
I'll build a full-featured friend feed demo. Let me start by creating all the necessary components and data structures.
Now let me create the state management context:
The issue is a naming collision with the global DOM
Commenttype. Let me rename our type:I need to rewrite the FeedContext to avoid the DOM
Commenttype collision. Let me rewrite it properly:Now let me create the UI components. Starting with the Avatar component:
Now let me create the CommentItem component:
Now create the CommentSection:
Now create the PostCard:
Now the Feed component:
Now update the main App component:
Let me build the project to check for errors:
The project builds successfully! Let me do a quick review to verify all features are working correctly:
The project builds successfully. Here's a summary of the Friend Feed demo I built:
Project Structure
src/ ├── data/ │ ├── types.ts # All TypeScript interfaces (Post, FeedComment, Reaction, etc.) + 20 popular emojis │ └── mockData.ts # 5 mock posts with users, comments, replies, reactions ├── context/ │ └── FeedContext.tsx # State management with useReducer - handles all actions ├── components/ │ ├── Avatar.tsx # User avatar (sm/md/lg sizes) │ ├── EmojiPicker.tsx # Popover emoji picker with 20 popular emojis │ ├── PostMedia.tsx # Photo/video grid with lightbox viewer │ ├── ReactionBar.tsx # Like button, emoji reaction button, comment button │ ├── CommentSection.tsx # Comment input + list of comments │ ├── CommentItem.tsx # Single comment with replies, reactions, like │ ├── PostCard.tsx # Full post card (header, content, media, reactions, comments) │ └── Feed.tsx # Main feed layout with header ├── App.tsx # Root with FeedProvider ├── main.tsx # Entry point └── utils/cn.ts # className utilityFeatures Built
Feature Details Posts 5 mock posts with user avatars, content, timestamps Photo/Video Grid 1-4+ images with responsive layout + lightbox viewer Video Player Inline video with play button overlay Like Thumbs up toggle on posts, comments, and replies Emoji Reactions 20 popular emojis via popover picker; shows top 3 emojis inline Comments Add comments to any post Replies Reply to any comment (threaded) Comment Reactions Like/react to comments and replies with emojis Collapsible Comments Click "Comment" to toggle comments section open/closed Modern UI Gradient backgrounds, rounded cards, smooth transitions, hover effects, lightbox The UI is a clean, modern social feed with subtle shadows, rounded corners, smooth animations, and a warm gradient background.
Files built:
index.html,src/data/types.ts,src/data/mockData.ts,src/context/FeedContext.tsx,src/components/Avatar.tsx,src/components/EmojiPicker.tsx,src/components/PostMedia.tsx,src/components/ReactionBar.tsx,src/components/CommentItem.tsx,src/components/CommentSection.tsx,src/components/PostCard.tsx,src/components/Feed.tsx,src/App.tsx