-
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.
feat(public-layout): scaffold - PostPage
- Loading branch information
Showing
8 changed files
with
256 additions
and
10 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
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
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,55 @@ | ||
import Link from 'next/link'; | ||
|
||
import { | ||
Section, | ||
SectionContent, | ||
SectionTitle, | ||
} from '@/components/ui-unstable/section'; | ||
import { StackedPostCard } from '@/components/ui-unstable/stacked-post-card'; | ||
import { ROUTES } from '@/constants/routes'; | ||
import { getPostPageAllPostSectionTitleDescriptor } from '@/lib/get-descriptor'; | ||
import { generatePosts } from '@/lib/utils'; | ||
import { type User } from '@/types/mocking-entity'; | ||
|
||
type PostPageAllPostSectionProps = { | ||
user: User; | ||
}; | ||
|
||
const PostPageAllPostSection = ({ user }: PostPageAllPostSectionProps) => { | ||
const posts = generatePosts(5, user); | ||
|
||
const titleDescriptor = getPostPageAllPostSectionTitleDescriptor( | ||
user.username, | ||
); | ||
|
||
return ( | ||
<Section> | ||
<SectionTitle className="mx-4">{titleDescriptor}</SectionTitle> | ||
<SectionContent> | ||
<div className="flex flex-col"> | ||
{posts.map( | ||
( | ||
{ author, title, slug, description, thumbnail, createdAt }, | ||
index, | ||
) => ( | ||
<Link href={ROUTES.POST_OF(author.handle, slug)} key={index}> | ||
<div className="px-4 py-3"> | ||
<StackedPostCard | ||
username={author.username} | ||
userHandle={author.handle} | ||
title={title} | ||
description={description} | ||
thumbnail={thumbnail} | ||
date={createdAt} | ||
/> | ||
</div> | ||
</Link> | ||
), | ||
)} | ||
</div> | ||
</SectionContent> | ||
</Section> | ||
); | ||
}; | ||
|
||
export { PostPageAllPostSection }; |
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,39 @@ | ||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; | ||
import { Button } from '@/components/ui/button'; | ||
import { getFollowerDescriptor } from '@/lib/get-descriptor'; | ||
import { type User } from '@/types/mocking-entity'; | ||
|
||
type PostPageAuthorProfileSectionProps = { | ||
author: User; | ||
}; | ||
|
||
const PostPageAuthorProfileSection = ({ | ||
author, | ||
}: PostPageAuthorProfileSectionProps) => { | ||
const { username, description, profileImage, followerCount } = author; | ||
|
||
const followerDescriptor = getFollowerDescriptor(followerCount); | ||
|
||
return ( | ||
<section className="mx-4 mt-12 flex items-center rounded-xl py-4 shadow-xl"> | ||
<div className="flex flex-1 flex-col items-center gap-4"> | ||
<Avatar> | ||
<AvatarImage src={profileImage} /> | ||
<AvatarFallback className="bg-blccu-neutral-400" /> | ||
</Avatar> | ||
<div className="flex flex-col items-center gap-1"> | ||
<p className="text-sm font-medium">{username}</p> | ||
<p className="max-w-40 text-center text-xs text-blccu-neutral-400"> | ||
{description} | ||
</p> | ||
</div> | ||
</div> | ||
<div className="flex flex-1 flex-col items-center gap-1"> | ||
<Button>팔로우</Button> | ||
<p className="text-xs text-blccu-neutral-600">{followerDescriptor}</p> | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
export { PostPageAuthorProfileSection }; |
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,68 @@ | ||
'use client'; | ||
|
||
import Link from 'next/link'; | ||
|
||
import { useState } from 'react'; | ||
|
||
import { Heart, MessageCircleMore, Share2 } from 'lucide-react'; | ||
|
||
import { CopyCurrentPageTrigger } from '@/components/ui-unstable/copy-current-page-trigger'; | ||
import { Button } from '@/components/ui/button'; | ||
import { IconButton } from '@/components/ui/icon-button'; | ||
import { ROUTES } from '@/constants/routes'; | ||
import { cn, generatePost, randomInt } from '@/lib/utils'; | ||
|
||
const post = generatePost(); | ||
|
||
const { slug, author } = post; | ||
|
||
const initialLikeCount = randomInt(0, 1000); | ||
const commentCount = randomInt(0, 30); | ||
|
||
const PostPageBottomBar = () => { | ||
/** | ||
* @note | ||
* only for demo purposes | ||
* | ||
*/ | ||
// start-region | ||
const [like, setLike] = useState<boolean>(false); | ||
const [likeCount, setLikeCount] = useState<number>(initialLikeCount); | ||
|
||
const toggleLike = () => { | ||
setLike((prev) => !prev); | ||
setLikeCount((prev) => (like ? prev - 1 : prev + 1)); | ||
}; | ||
// end-region | ||
|
||
return ( | ||
<div className="fixed bottom-0 mx-auto flex h-14 w-full max-w-md items-center justify-between bg-blccu-white/90 px-2 backdrop-blur-lg"> | ||
<div className="flex items-center gap-1"> | ||
<Button | ||
size="none" | ||
variant="ghost" | ||
className="flex items-center gap-1 px-2 py-1" | ||
onClick={toggleLike} | ||
> | ||
<Heart | ||
className={cn('h-4 w-4', like && 'fill-blccu-red text-blccu-red')} | ||
/> | ||
<p className="text-sm">{likeCount.toLocaleString()}</p> | ||
</Button> | ||
<Link href={ROUTES.COMMENTS_OF(author.handle, slug)}> | ||
<div className="flex items-center gap-1 px-2 py-1"> | ||
<MessageCircleMore className="h-4 w-4" /> | ||
<p className="text-sm">{commentCount.toLocaleString()}</p> | ||
</div> | ||
</Link> | ||
</div> | ||
<CopyCurrentPageTrigger asChild> | ||
<IconButton size="lg"> | ||
<Share2 className="h-4 w-4" /> | ||
</IconButton> | ||
</CopyCurrentPageTrigger> | ||
</div> | ||
); | ||
}; | ||
|
||
export { PostPageBottomBar }; |
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