Here’s my Assignment
CoinList.jsx
import React from 'react';
import Coin from '../Coin/Coin';
import styled from 'styled-components';
const TitleDetails = styled.th`
border: 2px solid burlywood;
width: 25vh;
background-color: black;
color: white;
`;
const Table = styled.table`
margin: 20px auto 20px auto;
display: inline-block;
font-size: 1.5rem;
`;
export default function CoinList(props) {
return (
<Table>
<thead>
<tr>
<TitleDetails>Name</TitleDetails>
<TitleDetails>Ticker</TitleDetails>
<TitleDetails>Price</TitleDetails>
{props.showBalance ?
<TitleDetails>Balance</TitleDetails> : null}
<TitleDetails>Actions</TitleDetails>
</tr>
</thead>
<tbody>
{
props.coinData.map(({key, name, ticker, price, balance}) =>
<Coin key={key}
handleRefresh = {props.handleRefresh}
name={name}
ticker={ticker}
price={price}
balance = {balance}
showBalance={props.showBalance}
/>
)
}
</tbody>
</Table>
)
}
AccountBalance.jsx
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
const Section1 = styled.section`
margin: auto;
box-shadow: 2px 2px 7px 1px black;
background-color: rgb(253, 239, 218);
float: center;
font-size: 1.5rem;
box-sizing: content-box;
font-weight: bold;
`;
export default function AccountBalance(props) {
const buttonText = props.showBalance ? 'Hide Balance' : 'Show Balance';
let balance = props.showBalance ?
<>Current Balance is: ${props.amount}</>
: null
return (
<Section1 className = "balance">
{balance}
<button onClick = {props.handleBalance}>{buttonText}</button>
</Section1>
);
}
AccountBalance.propTypes = {
amount: PropTypes.number.isRequired
}
AppHeader.jsx
import React from 'react';
import logo from './logo.svg';
import styled from 'styled-components';
const Header = styled.header`
background-color: #030011;
min-height: 20vh;
display: flex;
flex-direction: column;
align-items: inherit;
justify-content: flex-start;
color: white;
`;
const H1 = styled.h1`
font-size: 4rem;
font-style: oblique;
font-family: Georgia, 'Times New Roman', Times, serif;
`;
const P = styled.p`
font-size: 1.5rem;
font-style: normal;
font-family: 'Lucida Sans Regul';
`;
const Image = styled.img`
height: 20vmin;
pointer-events: none;
`;
export default function Appheader() {
return (
<Header>
<Image src={logo} alt="React logo" />
<H1>
Coin Exchange
</H1>
<P className = "App-subtitle">
by: Xyz Fiegalan
</P>
</Header>
);
}