Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/assets/sites/binance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/assets/sites/blockchain.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/assets/sites/coinmarketcap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions src/config/siteIcons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import BlockchainIcon from '../assets/sites/blockchain.svg';
import CoinmarketcapIcon from '../assets/sites/coinmarketcap.svg';
import BinanceIcon from '../assets/sites/binance.svg';
import type { SiteType } from '../types/site.type';

export const SITE_ICONS: Record<
SiteType,
{
icon: string;
alt: string;
}
> = {
BLOCKCHAIN: {
icon: BlockchainIcon,
alt: 'blockchain',
},
COINMARKETCAP: {
icon: CoinmarketcapIcon,
alt: 'coinmarketcap',
},
BINANCE: {
icon: BinanceIcon,
alt: 'binance',
},
};
19 changes: 19 additions & 0 deletions src/mocks/siteData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { SiteItem } from '../types/site.type';

export const siteData: SiteItem[] = [
{
id: 1,
type: 'BLOCKCHAIN',
url: 'https://www.naver.com',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naver? please check again

},
{
id: 2,
type: 'COINMARKETCAP',
url: 'https://www.google.com',
},
{
id: 3,
type: 'BINANCE',
url: 'https://www.youtube.com',
},
];
4 changes: 3 additions & 1 deletion src/pages/home/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import Navbar from '../../components/Navbar/Navbar';
import ListFilter from './components/Filter/ListFilter';
import ListSite from './components/Site/ListSite';
import Alert from './components/Alert/Alert';
import Banner from './components/Banner/Banner';
import Chart from './components/Chart/Chart';

const Home = () => {
return (
<>
<Banner />
<Navbar />
<Banner />
<ListFilter />
<Chart />
<ListSite />
<Alert />
</>
);
Expand Down
26 changes: 26 additions & 0 deletions src/pages/home/components/Site/ItemSite.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { SITE_ICONS } from '../../../../config/siteIcons';
import type { SiteItem } from '../../../../types/site.type';
import useNavigation from '../../../../hooks/useNavigation';

interface ItemSiteProps {
item: SiteItem;
}

const ItemSite = ({ item }: ItemSiteProps) => {
const { goTo } = useNavigation();
const ui = SITE_ICONS[item.type];

return (
<li>
<button
type="button"
onClick={() => goTo(item.url)}
className="flex items-center justify-center"
>
<img src={ui.icon} alt={ui.alt} className="h-12 w-auto" />
</button>
</li>
);
};

export default ItemSite;
14 changes: 14 additions & 0 deletions src/pages/home/components/Site/ListSite.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import ItemSite from './ItemSite';
import { siteData } from '../../../../mocks/siteData';

const ListSite = () => {
return (
<ul className="w-full flex items-center gap-[1.6rem] px-4 mt-6 mb-12">
{siteData.map((item) => (
<ItemSite key={item.id} item={item} />
))}
</ul>
);
};

export default ListSite;
7 changes: 7 additions & 0 deletions src/types/site.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type SiteType = 'BLOCKCHAIN' | 'COINMARKETCAP' | 'BINANCE';

export interface SiteItem {
id: number;
url: string;
type: SiteType;
}