WIP: Basic Jodel Application

This commit is contained in:
Pete Gerlach
2024-05-28 20:10:09 +02:00
parent b6999ff3ad
commit d2778cd922
17 changed files with 373 additions and 91 deletions

34
src/components/Post.js Normal file
View File

@@ -0,0 +1,34 @@
import React, { useState } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCaretUp, faCaretDown } from '@fortawesome/free-solid-svg-icons';
function Post({ post }) {
const [upvotes, setUpvotes] = useState(post.upvotes);
const [downvotes, setDownvotes] = useState(post.downvotes);
const handleUpvote = () => {
// Logic to handle upvote
setUpvotes(upvotes + 1);
};
const handleDownvote = () => {
// Logic to handle downvote
setDownvotes(downvotes + 1);
};
return (
<div className="post">
<p>{post.content}</p>
<div className="vote">
<FontAwesomeIcon icon={faCaretUp} onClick={handleUpvote} />
{upvotes}
</div>
<div className="vote">
<FontAwesomeIcon icon={faCaretDown} onClick={handleDownvote} />
{downvotes}
</div>
</div>
);
}
export default Post;