mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-12 05:26:46 +00:00
switch picture to avatarUrl; addLike and removeLike methods placeholders
This commit is contained in:
parent
b567eb7278
commit
e02262ce19
4 changed files with 24 additions and 14 deletions
|
|
@ -8,7 +8,7 @@ interface Post {
|
||||||
userID: string;
|
userID: string;
|
||||||
name: string;
|
name: string;
|
||||||
text: string;
|
text: string;
|
||||||
picture: string;
|
avatarUrl: string;
|
||||||
likes: string[];
|
likes: string[];
|
||||||
comments: Comment[];
|
comments: Comment[];
|
||||||
// date: Date;
|
// date: Date;
|
||||||
|
|
@ -20,21 +20,21 @@ interface Post {
|
||||||
export const dummyPost: Post = {
|
export const dummyPost: Post = {
|
||||||
id: '12',
|
id: '12',
|
||||||
userID: '42',
|
userID: '42',
|
||||||
picture:
|
avatarUrl:
|
||||||
'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200',
|
'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200',
|
||||||
name: 'John Doe',
|
name: 'John Doe',
|
||||||
text:
|
text:
|
||||||
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint possimus corporis sunt necessitatibus! Minus nesciunt soluta suscipit nobis. Amet accusamus distinctio cupiditate blanditiis dolor? Illo perferendis eveniet cum cupiditate aliquam?',
|
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint possimus corporis sunt necessitatibus! Minus nesciunt soluta suscipit nobis. Amet accusamus distinctio cupiditate blanditiis dolor? Illo perferendis eveniet cum cupiditate aliquam?',
|
||||||
comments: [
|
comments: [
|
||||||
{
|
{
|
||||||
picture:
|
avatarUrl:
|
||||||
'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200',
|
'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200',
|
||||||
name: 'John Doe',
|
name: 'John Doe',
|
||||||
text:
|
text:
|
||||||
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Sintpossimus corporis sunt necessitatibus! Minus nesciunt solutasuscipit nobis. Amet accusamus distinctio cupiditate blanditiis dolor? Illo perferendis eveniet cum cupiditate aliquam?',
|
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Sintpossimus corporis sunt necessitatibus! Minus nesciunt solutasuscipit nobis. Amet accusamus distinctio cupiditate blanditiis dolor? Illo perferendis eveniet cum cupiditate aliquam?',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
picture:
|
avatarUrl:
|
||||||
'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200',
|
'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200',
|
||||||
name: 'Ruidy Nemo',
|
name: 'Ruidy Nemo',
|
||||||
text:
|
text:
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ const PostPage: FC<Post> = () => (
|
||||||
<div className="post bg-white p-1 my-1">
|
<div className="post bg-white p-1 my-1">
|
||||||
<div>
|
<div>
|
||||||
<a href="profile.html">
|
<a href="profile.html">
|
||||||
<img className="round-img" src={post.picture} alt={post.name} />
|
<img className="round-img" src={post.avatarUrl} alt={post.name} />
|
||||||
<h4>{post.name}</h4>
|
<h4>{post.name}</h4>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -43,7 +43,7 @@ const PostPage: FC<Post> = () => (
|
||||||
<div className="post bg-white p-1 my-1" key={i}>
|
<div className="post bg-white p-1 my-1" key={i}>
|
||||||
<div>
|
<div>
|
||||||
<a href="profile.html">
|
<a href="profile.html">
|
||||||
<img className="round-img" src={c.picture} alt={c.name} />
|
<img className="round-img" src={c.avatarUrl} alt={c.name} />
|
||||||
<h4>{c.name}</h4>
|
<h4>{c.name}</h4>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ import Post, {dummyPost as post} from '../models/Post';
|
||||||
import Header from '../components/Header';
|
import Header from '../components/Header';
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
||||||
import {faThumbsUp, faThumbsDown} from '@fortawesome/free-solid-svg-icons';
|
import {faThumbsUp, faThumbsDown} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import Routes from '../constants/routes';
|
||||||
|
import {Link} from 'react-router-dom';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Dev's Posts list
|
* A Dev's Posts list
|
||||||
|
|
@ -10,6 +12,11 @@ import {faThumbsUp, faThumbsDown} from '@fortawesome/free-solid-svg-icons';
|
||||||
const Posts: FC = () => {
|
const Posts: FC = () => {
|
||||||
const posts: Post[] = [post, post];
|
const posts: Post[] = [post, post];
|
||||||
|
|
||||||
|
const removeLike = (e: React.MouseEvent<HTMLButtonElement>) =>
|
||||||
|
new Error('Not implemented yet.');
|
||||||
|
const addLike = (e: React.MouseEvent<HTMLButtonElement>) =>
|
||||||
|
new Error('Not implemented yet.');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="container">
|
<section className="container">
|
||||||
<Header title="Posts" lead="Welcome to the community" />
|
<Header title="Posts" lead="Welcome to the community" />
|
||||||
|
|
@ -25,26 +32,29 @@ const Posts: FC = () => {
|
||||||
{posts.map((post: Post) => (
|
{posts.map((post: Post) => (
|
||||||
<div className="post bg-white p-1 my-1" key={post.id}>
|
<div className="post bg-white p-1 my-1" key={post.id}>
|
||||||
<div>
|
<div>
|
||||||
<a href="profile.html">
|
<Link to={`${Routes.PROFILE}/${post.userID}`}>
|
||||||
<img
|
<img
|
||||||
src={post.picture}
|
src={post.avatarUrl}
|
||||||
alt={post.name}
|
alt={post.name}
|
||||||
className="round-img"
|
className="round-img"
|
||||||
/>
|
/>
|
||||||
<h4>{post.name}</h4>
|
<h4>{post.name}</h4>
|
||||||
</a>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p className="my-1">{post.text}</p>
|
<p className="my-1">{post.text}</p>
|
||||||
<button className="btn btn-light">
|
<button className="btn btn-light" onClick={addLike}>
|
||||||
<FontAwesomeIcon icon={faThumbsUp} /> {post.likes.length}
|
<FontAwesomeIcon icon={faThumbsUp} /> {post.likes.length}
|
||||||
</button>
|
</button>
|
||||||
<button className="btn btn-light">
|
<button className="btn btn-light" onClick={removeLike}>
|
||||||
<FontAwesomeIcon icon={faThumbsDown} />
|
<FontAwesomeIcon icon={faThumbsDown} />
|
||||||
</button>
|
</button>
|
||||||
<a href="post.html" className="btn btn-primary">
|
<Link
|
||||||
|
to={`${Routes.POST}/${post.id}`}
|
||||||
|
className="btn btn-primary"
|
||||||
|
>
|
||||||
Discussion
|
Discussion
|
||||||
</a>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ interface Comment {
|
||||||
// userID: string;
|
// userID: string;
|
||||||
text: string;
|
text: string;
|
||||||
name: string;
|
name: string;
|
||||||
picture: string;
|
avatarUrl: string;
|
||||||
// date: Date;
|
// date: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue