-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* FE-74 fix: 사용하지 않는 lodash 라이브러리 삭제 * FE-74 ✨feat: 테스트 용 api 코드 가져오기 * FE-74 ✨feat: 검색 결과 기능 구현 * FE-74 ✨fix: 중복된 key, href 제거 및 규칙 무시 주석 추가 * FE-74 ✨test: 테스트 데이터 추가 * FE-74 ✨feat: 검색어 하이라이팅 및 순서 기능 추가 * FE-74 ✨fix: 주석 수정 및 api 파일 삭제 * FE-74 ✨styles: 주석 추가 * FE-74 ✨fix: 멘토링 내용 주석으로 추가
- Loading branch information
1 parent
c3b3536
commit 81d7b90
Showing
8 changed files
with
232 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,71 @@ | ||
const testData = { | ||
totalCount: 5, | ||
nextCursor: 5, | ||
list: [ | ||
{ | ||
id: 1, | ||
likeCount: 10, | ||
tags: [ | ||
{ name: '동기부여', id: 101 }, | ||
{ name: '우울할때', id: 102 }, | ||
{ name: '나아가야할때', id: 103 }, | ||
], | ||
writerId: 1001, | ||
referenceUrl: 'https://example.com/epigram/1', | ||
referenceTitle: 'The Power of Dreams', | ||
author: '앙드레 말로', | ||
content: '오랫동안 꿈을 그리는 사람은 마침내 그 꿈을 닮아 간다.', | ||
}, | ||
{ | ||
id: 2, | ||
likeCount: 20, | ||
tags: [{ name: '새로운영감', id: 201 }], | ||
writerId: 1002, | ||
referenceUrl: 'https://example.com/epigram/2', | ||
referenceTitle: 'Life Lessons', | ||
author: '파우울로 코엘료 테스트', | ||
content: '이 세상에는 위대한 진실이 하나 있어. 무언가를 온 마음을 다해 원한다면, 반드시 그렇게 된다는거야.', | ||
}, | ||
{ | ||
id: 3, | ||
likeCount: 15, | ||
tags: [ | ||
{ name: '짧은명언', id: 301 }, | ||
{ name: '우울증', id: 302 }, | ||
], | ||
writerId: 1003, | ||
referenceUrl: 'https://example.com/epigram/3', | ||
referenceTitle: 'Path to Success', | ||
author: '클라우스 랑에', | ||
content: '우울증이란 우리를 내적인 나락으로 이끄는 유혹의 손길이다. 테스트', | ||
}, | ||
{ | ||
id: 4, | ||
likeCount: 5, | ||
tags: [ | ||
{ name: 'motivation', id: 401 }, | ||
{ name: 'challenge', id: 402 }, | ||
], | ||
writerId: 1004, | ||
referenceUrl: 'https://example.com/epigram/4', | ||
referenceTitle: 'Overcoming Challenges', | ||
author: '테스트터티', | ||
content: '우울한 기분은 신나는 기분을 더욱 더 신나게 만들어준다.', | ||
}, | ||
{ | ||
id: 5, | ||
likeCount: 8, | ||
tags: [ | ||
{ name: '테스트', id: 501 }, | ||
{ name: 'discipline', id: 502 }, | ||
], | ||
writerId: 1005, | ||
referenceUrl: 'https://example.com/epigram/5', | ||
referenceTitle: 'Staying Focused', | ||
author: 'David Wilson', | ||
content: '그렇게 우울은 흘러가고 새로운 기분이 우릴 맞이할 것이다.', | ||
}, | ||
], | ||
}; | ||
|
||
export default testData; |
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,41 @@ | ||
// pages/epigrams/[id].tsx | ||
import React from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import testData from '@/components/search/test'; | ||
|
||
function EpigramDetail() { | ||
const router = useRouter(); | ||
const { id } = router.query; | ||
|
||
// `id`가 숫자인 경우를 대비하여 변환 | ||
const epigramId = parseInt(id as string, 10); | ||
const epigram = testData.list.find((e) => e.id === epigramId); | ||
|
||
if (!epigram) { | ||
return <div>해당 에피그램을 찾을 수 없습니다.</div>; | ||
} | ||
|
||
return ( | ||
<div style={{ padding: '20px' }}> | ||
<h1>에피그램 상세 페이지</h1> | ||
<h2>{epigram.content}</h2> | ||
<p>작성자: {epigram.author}</p> | ||
<p> | ||
참조 제목:{' '} | ||
<a href={epigram.referenceUrl} target='_blank' rel='noopener noreferrer'> | ||
{epigram.referenceTitle} | ||
</a> | ||
</p> | ||
<div> | ||
<strong>태그: </strong> | ||
{epigram.tags.map((tag) => ( | ||
<span key={tag.id} style={{ marginRight: '5px' }}> | ||
#{tag.name} | ||
</span> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default EpigramDetail; |
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,33 @@ | ||
import * as z from 'zod'; | ||
|
||
export const GetEpigramsParams = z.object({ | ||
limit: z.number(), | ||
cursor: z.number().optional(), | ||
keyword: z.string().optional(), | ||
writerId: z.number().optional(), | ||
}); | ||
|
||
export const GetEpigramsResponse = z.object({ | ||
totalCount: z.number(), | ||
nextCursor: z.number(), | ||
list: z.array( | ||
z.object({ | ||
likeCount: z.number(), | ||
tags: z.array( | ||
z.object({ | ||
name: z.string(), | ||
id: z.number(), | ||
}), | ||
), | ||
writerId: z.number(), | ||
referenceUrl: z.string(), | ||
referenceTitle: z.string(), | ||
author: z.string(), | ||
content: z.string(), | ||
id: z.number(), | ||
}), | ||
), | ||
}); | ||
|
||
export type GetEpigramsParamsType = z.infer<typeof GetEpigramsParams>; | ||
export type GetEpigramsResponseType = z.infer<typeof GetEpigramsResponse>; |