diff --git a/src/App.js b/src/App.js
index 9d9aa1c..8a5f603 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,18 +1,126 @@
import React, { useState } from 'react';
-import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
-import Home from './components/Home';
-import PostDetail from './components/PostDetail';
+import PostList from './components/PostList';
+import NewPostForm from './components/NewPostForm';
+import Modal from './components/Modal';
+import './App.scss';
+import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
+import {faCaretDown, faCaretUp} from "@fortawesome/free-solid-svg-icons";
+
+const App = () => {
+ const [posts, setPosts] = useState([]);
+ const [selectedPost, setSelectedPost] = useState(null);
+ const [comment, setComment] = useState('');
+
+ const addPost = (text) => {
+ const newPost = { id: Date.now(), text, comments: [], upvotes: 0, downvotes: 0 };
+ setPosts([newPost, ...posts]);
+ };
+
+ const addComment = (postId, commentText) => {
+ const newComment = { id: Date.now(), text: commentText, upvotes: 0, downvotes: 0 };
+ setPosts(posts.map(post =>
+ post.id === postId ? { ...post, comments: [...post.comments, newComment] } : post
+ ));
+ };
+
+ const upvotePost = (postId) => {
+ setPosts(posts.map(post =>
+ post.id === postId ? { ...post, upvotes: post.upvotes + 1 } : post
+ ));
+ };
+
+ const downvotePost = (postId) => {
+ setPosts(posts.map(post =>
+ post.id === postId ? { ...post, downvotes: post.downvotes + 1 } : post
+ ));
+ };
+
+ const upvoteComment = (postId, commentId) => {
+ setPosts(posts.map(post =>
+ post.id === postId ? {
+ ...post,
+ comments: post.comments.map(comment =>
+ comment.id === commentId ? { ...comment, upvotes: comment.upvotes + 1 } : comment
+ )
+ } : post
+ ));
+ };
+
+ const downvoteComment = (postId, commentId) => {
+ setPosts(posts.map(post =>
+ post.id === postId ? {
+ ...post,
+ comments: post.comments.map(comment =>
+ comment.id === commentId ? { ...comment, downvotes: comment.downvotes + 1 } : comment
+ )
+ } : post
+ ));
+ };
+
+ const handlePostClick = (post) => {
+ setSelectedPost(post);
+ };
+
+ const handleCommentSubmit = (e) => {
+ e.preventDefault();
+ if (comment.trim() && selectedPost) {
+ addComment(selectedPost.id, comment);
+ setComment('');
+ }
+ };
+
+ const closeModal = () => {
+ setSelectedPost(null);
+ setComment('');
+ };
-function App() {
return (
-
{selectedPost.text}
+ +{comment.text}
+{post.content}
-{post.content}
-{post.text}
{comment.content}
-