-
Notifications
You must be signed in to change notification settings - Fork 1
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
[FE] staleTime옵션 추가 & 해더 버튼 클릭 이벤트 최적화 & 뉴스 레이아웃 #196
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
882276c
✨ feat: socket 연결 로직 추가.
dannysir 4add332
🔧 fix: useQuery 에러처리 추가.
dannysir 937da86
♻️ refactor: 헤더 버튼 클릭 관련 최적화.
dannysir f62d4ac
✨ feat: 뉴스 레이아웃 기초 작업 #188
dannysir ee0fb52
🔧 fix: 검색 관련 캐싱 처리 추가 #191
dannysir a0b8e0f
✨ feat: 뉴스 레이아웃 생성 #188
dannysir 1492548
🔧 fix: 랭킹 관련 fetch 요청에 쿠키 포함 옵션 추가 #133
dannysir 0c53b04
✨ feat: 랭킹 API 연동 #133
dannysir 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
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,32 @@ | ||
import { NewsMockDataType } from './newsMockData.ts'; | ||
|
||
type CardWithImageProps = { | ||
data: NewsMockDataType; | ||
}; | ||
export default function CardWithImage({ data }: CardWithImageProps) { | ||
return ( | ||
<div className='cursor-pointer overflow-hidden rounded-lg'> | ||
{/* 이미지 컨테이너 */} | ||
<div className='relative h-[144px] overflow-hidden'> | ||
<img | ||
src={data.img} | ||
alt='news thumbnail' | ||
className='h-full w-full rounded-lg object-cover transition-transform duration-300 hover:scale-105' | ||
/> | ||
</div> | ||
|
||
<div className='flex max-h-[80px] flex-col justify-between gap-1'> | ||
{/* 뉴스 제목 */} | ||
<h3 className='truncate text-left text-base font-semibold text-juga-grayscale-black'> | ||
{data.title} | ||
</h3> | ||
|
||
{/* 날짜와 출판사 */} | ||
<div className='flex justify-between text-sm text-juga-grayscale-500'> | ||
<div>{data.date}</div> | ||
<div>{data.publisher}</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default function CardWithoutImage() { | ||
return ( | ||
<div className='flex cursor-pointer items-center justify-between hover:underline'> | ||
<span className='truncate text-left text-sm text-juga-grayscale-black'> | ||
[단독] 반도체 산업 신규 투자 확대...정부 지원책 발표 | ||
</span> | ||
<span className='whitespace-nowrap text-right text-xs text-juga-grayscale-500'> | ||
중앙일보 | ||
</span> | ||
</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,27 @@ | ||
import CardWithImage from './CardWithImage.tsx'; | ||
import CardWithoutImage from './CardWithoutImage.tsx'; | ||
import { newsMockData, NewsMockDataType } from './newsMockData.ts'; | ||
|
||
export default function News() { | ||
return ( | ||
<div | ||
className={'items-center, mt-7 flex w-full flex-col justify-center gap-3'} | ||
> | ||
<div className={'flex flex-row'}> | ||
<div className={'text-left text-xl font-bold'}>주요 뉴스</div> | ||
</div> | ||
<ul className='grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4'> | ||
{newsMockData.slice(0, 4).map((data: NewsMockDataType) => ( | ||
<CardWithImage data={data} key={data.title} /> | ||
))} | ||
</ul> | ||
|
||
<ul className='mt-5 grid grid-cols-2 gap-3'> | ||
<CardWithoutImage /> | ||
<CardWithoutImage /> | ||
<CardWithoutImage /> | ||
<CardWithoutImage /> | ||
</ul> | ||
</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,45 @@ | ||
export type NewsMockDataType = { | ||
publisher: string; | ||
img: string; | ||
title: string; | ||
date: string; | ||
link: string; | ||
}; | ||
|
||
export const newsMockData: NewsMockDataType[] = [ | ||
{ | ||
publisher: '중앙일보', | ||
img: 'https://s.pstatic.net/dthumb.phinf/?src=%22https%3A%2F%2Fs.pstatic.net%2Fstatic%2Fnewsstand%2F2024%2F1125%2Farticle_img%2Fnew_main%2F9152%2F071102_001.jpg%22&type=nf312_208&service=navermain', | ||
title: '[단독] 반도체 산업 신규 투자 확대...정부 지원책 발표', | ||
date: '11월 03일 18:55 직접 편집', | ||
link: 'https://www.joongang.co.kr/article/25288962', | ||
}, | ||
{ | ||
publisher: '동아일보', | ||
img: 'https://s.pstatic.net/dthumb.phinf/?src=%22https%3A%2F%2Fs.pstatic.net%2Fstatic%2Fnewsstand%2F2024%2F1125%2Farticle_img%2Fnew_main%2F9131%2F172557_001.jpg%22&type=nf312_208&service=navermain', | ||
title: '청년 주거대책 발표...월세 지원 확대', | ||
date: '11월 03일 18:39 직접 편집', | ||
link: 'https://www.donga.com/news/article/all/20241103/123456', | ||
}, | ||
{ | ||
publisher: '한국경제', | ||
img: 'https://s.pstatic.net/dthumb.phinf/?src=%22https%3A%2F%2Fs.pstatic.net%2Fstatic%2Fnewsstand%2F2024%2F1125%2Farticle_img%2Fnew_main%2F9029%2F175118_001.jpg%22&type=nf312_208&service=navermain', | ||
title: '기준금리 동결 전망...시장 영향은?', | ||
date: '11월 03일 17:50 직접 편집', | ||
link: 'https://www.hankyung.com/article/2024110387654', | ||
}, | ||
{ | ||
publisher: '매일경제', | ||
img: 'https://s.pstatic.net/dthumb.phinf/?src=%22https%3A%2F%2Fs.pstatic.net%2Fstatic%2Fnewsstand%2F2024%2F1125%2Farticle_img%2Fnew_main%2F9243%2F174551_001.jpg%22&type=nf312_208&service=navermain', | ||
title: '글로벌 기업들의 韓 투자 러시...배경은?', | ||
date: '11월 03일 17:30 직접 편집', | ||
link: 'https://www.mk.co.kr/news/2024/11/123987', | ||
}, | ||
{ | ||
publisher: '한겨레', | ||
img: 'https://s.pstatic.net/static/newsstand/2024/1103/article_img/9005/171525_001.jpg', | ||
title: '환경부, 신재생에너지 정책 전면 개편 추진', | ||
date: '11월 03일 17:15 직접 편집', | ||
link: 'https://www.hani.co.kr/arti/20241103-654321', | ||
}, | ||
]; |
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 |
---|---|---|
@@ -1,4 +1,15 @@ | ||
export type TmpDataType = { | ||
export type RankingItem = { | ||
nickname: string; | ||
rank: number; | ||
value: number; | ||
}; | ||
|
||
export type RankingCategory = { | ||
topRank: RankingItem[]; | ||
userRank: RankingItem; | ||
}; | ||
|
||
export type RankingData = { | ||
profitRateRanking: RankingCategory; | ||
assetRanking: RankingCategory; | ||
}; |
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.
좋습니다! 페이지 이동 작업을 줄일 수 있겠네요 👍👍