-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[고재성] Sprint9 #646
Merged
ding-co
merged 10 commits into
codeit-bootcamp-frontend:Next.js-고재성
from
devjaesung:Next.js-고재성-sprint9
Jun 11, 2024
The head ref may contain hidden characters: "Next.js-\uACE0\uC7AC\uC131-sprint9"
Merged
[고재성] Sprint9 #646
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
93a0e93
chore: 머지 후 브랜치 삭제 github action 추가
withyj-codeit b2e37bd
reset
hanseulhee 6f8bbb0
Merge branch 'codeit-bootcamp-frontend:main' into main
hanseulhee e11e25f
fix: 머지 후 브랜치 삭제 github action 수정
hanseulhee 212e864
env: workflows 폴더로 이동
hanseulhee 4dc5dd0
Merge pull request #237 from hanseulhee/fix-github-actions
withyj-codeit 1a64a17
Merge branch 'Next.js-고재성' of https://github.com/codeit-bootcamp-fron…
devjaesung b591ab4
feat: Next.js 초기 설정 및 tailwind적용
devjaesung 75672d0
refactor: next.js초기설정 및 헤더 컴포넌트
devjaesung 88c122b
feat: 베스트 게시글 구현
devjaesung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,15 @@ | ||
export interface Article { | ||
updatedAt: Date; | ||
createdAt: Date; | ||
likeCount: number; | ||
writer: { nickname: string; id: number }; | ||
image: string; | ||
content: string; | ||
title: string; | ||
id: number; | ||
} | ||
|
||
export interface ArticleListResponse { | ||
totalCount: number; | ||
list: Article[]; | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. components/Header/index.tsx 로 하면 import 할 때 중복으로 Header/Header 이렇게 안써도 되는 것 참고해주세요~ |
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,26 @@ | ||
import Link from "next/link"; | ||
import Image from "next/image"; | ||
import Logo from "@/public/logo.png"; | ||
|
||
export default function Header() { | ||
return ( | ||
<header className="flex justify-between items-center px-20 py-2 gap-10 border-b-2 bg-white"> | ||
<Link href="/"> | ||
<Image src={Logo} alt="logo" width={128} height={48} /> | ||
</Link> | ||
<div className="grow flex"> | ||
<Link href="/boards"> | ||
<p className="text-lg text-primaryColor mr-4 font-bold">자유게시판</p> | ||
</Link> | ||
<Link href="/items"> | ||
<p className="text-lg text-coolGray-600 mr-4 font-bold">중고마켓</p> | ||
</Link> | ||
</div> | ||
<Link href="/login"> | ||
<p className="bg-primaryColor hover:bg-blue-400 px-4 py-3 text-white rounded-lg"> | ||
로그인 | ||
</p> | ||
</Link> | ||
</header> | ||
); | ||
} |
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,46 @@ | ||
import { Article } from "@/@types/api"; | ||
import Image from "next/image"; | ||
import Medal from "@/public/ic_medal.png"; | ||
import Heart from "@/public/heart.png"; | ||
import { formatDate } from "@/utils/dateformat"; | ||
|
||
export default function ArticleCard({ article }: { article: Article }) { | ||
const formattedDate = formatDate(new Date(article.createdAt)); | ||
return ( | ||
<div className="w-[400px] bg-coolGray-50 px-10 rounded-[8px]"> | ||
<div className="w-[120px] h-[30px] bg-primaryColor flex justify-center items-center rounded-b-[32px] p-2 gap-1"> | ||
<Image src={Medal} width={20} height={20} alt="medal" /> | ||
<p className="text-white">Best</p> | ||
</div> | ||
<div className="h-[100px] flex justify-between my-4 relative"> | ||
<p className="w-[240px] font-semibold text-lg mb-5">{article.title}</p> | ||
<div className="w-[80px] relative"> | ||
{article.image ? ( | ||
<Image | ||
src={article.image} | ||
alt="thumbnail" | ||
fill | ||
className="object-fit" | ||
/> | ||
) : null} | ||
</div> | ||
</div> | ||
<div className="flex justify-between text-sm text-coolGray-600"> | ||
<div className="flex gap-2 pb-5"> | ||
<p>{article.writer.nickname}</p> | ||
<div className="flex gap-1"> | ||
<Image | ||
src={Heart} | ||
width={14} | ||
height={14} | ||
alt="heart" | ||
className="h-[16px]" | ||
/> | ||
<p>{article.likeCount}</p> | ||
</div> | ||
</div> | ||
<p>{formattedDate}</p> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Article, ArticleListResponse } from "@/@types/api"; | ||
import ArticleCard from "@/components/boards/ArticleCard"; | ||
|
||
export default function BestArticle({ articles }: { articles: Article[] }) { | ||
return ( | ||
<div> | ||
<h1 className="text-xl font-bold mb-5">베스트 게시글</h1> | ||
<div className="flex gap-5"> | ||
{articles.slice(0, 3).map((article) => ( | ||
<ArticleCard key={article.id} article={article} /> | ||
))} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
} | ||
images: { | ||
domains: ["sprint-fe-project.s3.ap-northeast-2.amazonaws.com"], | ||
}, | ||
}; | ||
|
||
module.exports = nextConfig | ||
module.exports = nextConfig; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이렇게 각각 type을 export 하셔도 되고 아니면 맨 아래에서
export type { Article, ArticleListResponse }
한번에 모아서도 가능한 것 참고해주세요~