기존 메인 페이지
기존 디테일 페이지
변경 후 메인 페이지
변경 후 디테일 페이지
- Coin.tsx
return (
<>
<BackBtn>
<Link to="/">🏛️</Link>
</BackBtn>
position : absolute;
줬다const BackBtn = styled.p`
position: absolute;
top: 30px;
left: 30px;
width: 40px;
height: 40px;
font-size: 25px;
background-color: #e4e6ed;
border-radius: 50%;
a {
position: absolute;
top: 5px;
left: 3px;
}
`;
- Coin.tsx
<Routes>
<Route path="chart" element={<Chart coinId={coinId!} />} />
<Route
path="price"
element={<Price tickersData={tickersData!} />}
/>
</Routes>
- Price.tsx
function Price({ tickersData }: { tickersData: PriceData }) {
return ( ...
tickersData
의 interface
도 같이 가져왔다.function Price({ tickersData }: { tickersData: PriceData }) {
return (
<>
<PriceInfoContainer>
<div>Price Change Informaton</div>
</PriceInfoContainer>
<PirceInfoDetail>
<PriceAgo>
30 Minutes Ago:
<span>{tickersData.quotes.USD.percent_change_30m}%</span>
</PriceAgo>
<PriceAgo>
1 Hours Ago: <span>{tickersData.quotes.USD.percent_change_1h}%</span>
</PriceAgo>
<PriceAgo>
6 Hours Ago:
<span>{tickersData.quotes.USD.percent_change_1h}%</span>
</PriceAgo>
const PriceInfoContainer = styled.div`
text-align: center;
font-size: 18px;
font-weight: 800;
margin-bottom: 50px;
margin-top: 40px;
background: #0be881;
background: linear-gradient(to right, #0be881 28%, #0fbcf9 80%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
`;
const PriceAgo = styled.div`
...
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 5;
transform: none;
}
}
animation: fadeIn 0.5s ease-in-out;
span {
font-size: 17px;
}