-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix routes and create Title component for posts
- Loading branch information
David Martinelli
committed
Feb 26, 2024
1 parent
5571b4e
commit 88415f8
Showing
4 changed files
with
65 additions
and
5 deletions.
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
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 |
---|---|---|
@@ -1,7 +1,19 @@ | ||
export function Post() { | ||
import { BlogHeader } from '@pages/Blog'; | ||
import Scrollbars from 'rc-scrollbars'; | ||
import { Item } from '../../models/issue.interface'; | ||
import { Title } from './components/Title'; | ||
|
||
type PostProps = { | ||
post?: Item; | ||
}; | ||
|
||
export function Post({ post }: PostProps) { | ||
return ( | ||
<> | ||
<h1>Post</h1> | ||
</> | ||
<div className="flex flex-col w-full bg-base-background"> | ||
<Scrollbars autoHideDuration={200} autoHideTimeout={1000} style={{ width: '100%', height: '100vh' }}> | ||
<BlogHeader /> | ||
<div className="container max-w-[1048px] mx-auto -mt-20 z-10">{post && <Title post={post} />}</div> | ||
</Scrollbars> | ||
</div> | ||
); | ||
} |
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,42 @@ | ||
import { FaGithub, FaUserGroup, FaArrowUpRightFromSquare, FaCalendar, FaChevronLeft } from 'react-icons/fa6'; | ||
import { Item } from '../../../models/issue.interface'; | ||
import { formatDistanceToNow } from 'date-fns'; | ||
|
||
type ItemProps = { | ||
post: Item; | ||
}; | ||
|
||
export function Title({ post }: ItemProps) { | ||
return ( | ||
<div className="flex gap-10 bg-base-profile py-8 px-10 rounded-2xl drop-shadow-lg"> | ||
<div className="flex"> | ||
<div className="absolute right-10 flex flex-row text-xs"> | ||
<a href="https://github.com/davidrock" className="flex items-center gap-2"> | ||
Back | ||
<FaArrowUpRightFromSquare width={12} height={12} /> | ||
</a> | ||
</div> | ||
<div className="absolute right-10 flex flex-row text-xs"> | ||
<a href="https://github.com/davidrock" className="flex items-center gap-2"> | ||
Go to Github | ||
<FaChevronLeft width={12} height={12} /> | ||
</a> | ||
</div> | ||
</div> | ||
<div className="flex flex-col gap-2"> | ||
<h1>{post?.title}</h1> | ||
<div className="flex gap-6 items-center mt-4"> | ||
<div className="flex items-center gap-2"> | ||
<FaGithub /> {post?.user.login} | ||
</div> | ||
<div className="flex items-center gap-2"> | ||
<FaCalendar /> {formatDistanceToNow(post.updated_at, { addSuffix: true })} | ||
</div> | ||
<div className="flex items-center gap-2"> | ||
<FaUserGroup /> {post.comments} comments | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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