-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCardList.tsx
More file actions
34 lines (29 loc) ยท 1.39 KB
/
CardList.tsx
File metadata and controls
34 lines (29 loc) ยท 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { STOCK_UPDATE_TIME } from '@ts/Constants';
import { StockCountryKey } from '@ts/StockCountry';
import useAboutCardList, { CardListType } from '@components/Modal/CenterTutorial/AboutCardList/useAboutCardList';
import { useHomeStockFetchQuery } from '@controllers/stocks/query';
import InfoSVG from '@assets/icons/info.svg?react';
import { CardListContainer, CardListTitle } from './CardList.Style';
import StockCard from './StockCard/StockCard';
const cardListTitle: Record<CardListType, string> = {
HOT: '๐ ํ์ฌ ์์ฅ ๋ฐ์ TOP 3',
RISING: '๐ฅ ํ์ฌ ๋ฏผ์ฌ ๊ธ์์น ์ค',
DESCENT: '๐ง ํ์ฌ ๋ฏผ์ฌ ๊ธํ๋ฝ ์ค',
};
const CardList = ({ type, country }: { type: CardListType; country: StockCountryKey }) => {
const updateTime = STOCK_UPDATE_TIME[country];
const { data: stocks } = useHomeStockFetchQuery(type, country);
const { Modal: AboutCardListModal, openModal: openAboutCardListModal } = useAboutCardList(type);
return (
<CardListContainer>
{AboutCardListModal}
<CardListTitle>
<p className="title">{`${cardListTitle[type]}`}</p>
<InfoSVG onClick={() => openAboutCardListModal({ type })} />
<p className="update-time">์ด์ {updateTime} ๊ธฐ์ค</p>
</CardListTitle>
<StockCard type={type} stocks={stocks} size={type === 'HOT' ? 'large' : 'small'} country={country} />
</CardListContainer>
);
};
export default CardList;