-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #546 from seregad544/author_pages
[#543] add author page
- Loading branch information
Showing
4 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import Image from 'next/image'; | ||
import { useTranslation } from 'next-i18next'; | ||
|
||
import Post from './Post.jsx'; | ||
|
||
const AuthorPage = ({ author, avatar, description, posts }) => { | ||
const { t } = useTranslation('author'); | ||
|
||
const postsList = posts.filter((post) => post.author === author).map((post) => | ||
<div key={post.name} className="mb-4"> | ||
<Post post={post} /> | ||
</div> | ||
); | ||
|
||
return ( | ||
<div className="row mx-lg-5"> | ||
<div className="col-md-4 mb-5"> | ||
<div className="card"> | ||
<div className="card-block"> | ||
<Image | ||
className="rounded-circle" | ||
src={avatar} | ||
alt="avatar" | ||
width={300} | ||
height={300} | ||
/> | ||
<h2>{author}</h2> | ||
<p className="card-text text-muted"> | ||
{description} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="col-md-8"> | ||
<h2>{t('publications')}</h2> | ||
<hr/> | ||
{postsList} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AuthorPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"publications": "Publications" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"publications": "Публикации" | ||
} |
749f232
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
hexletguides – ./
hexletguides-hexlet.vercel.app
hexletguides-git-main-hexlet.vercel.app
guides.hexlet.io