finishing minor changes
This commit is contained in:
parent
c23c025181
commit
83fce98e50
@ -5,6 +5,7 @@ import Box from '@mui/material/Box';
|
|||||||
import Grid from '@mui/material/Grid';
|
import Grid from '@mui/material/Grid';
|
||||||
import Container from '@mui/material/Container';
|
import Container from '@mui/material/Container';
|
||||||
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
||||||
|
import { teal } from '@mui/material/colors';
|
||||||
|
|
||||||
import Header from './Header'
|
import Header from './Header'
|
||||||
import CoinList from './coinList/coinList';
|
import CoinList from './coinList/coinList';
|
||||||
@ -27,8 +28,22 @@ function App() {
|
|||||||
const theme = React.useMemo(
|
const theme = React.useMemo(
|
||||||
() =>
|
() =>
|
||||||
createTheme({
|
createTheme({
|
||||||
|
typography: {
|
||||||
|
h1: {
|
||||||
|
fontSize: 28,
|
||||||
|
fontWeight: 500,
|
||||||
|
},
|
||||||
|
h2: {
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: 200,
|
||||||
|
paddingBottom: 20,
|
||||||
|
}
|
||||||
|
},
|
||||||
palette: {
|
palette: {
|
||||||
mode,
|
mode,
|
||||||
|
primary: {
|
||||||
|
main: teal[700],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
[mode],
|
[mode],
|
||||||
@ -39,7 +54,7 @@ function App() {
|
|||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<ColorModeContext.Provider value={colorMode}>
|
<ColorModeContext.Provider value={colorMode}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
<Header colorMode={colorMode} theme={theme} />
|
<Header />
|
||||||
<Container maxWidth="md">
|
<Container maxWidth="md">
|
||||||
<Box sx={{ flexGrow: 1 }}>
|
<Box sx={{ flexGrow: 1 }}>
|
||||||
<Grid container
|
<Grid container
|
||||||
|
|||||||
@ -5,23 +5,11 @@ import Box from '@mui/material/Box';
|
|||||||
import AppBar from '@mui/material/AppBar';
|
import AppBar from '@mui/material/AppBar';
|
||||||
import Toolbar from '@mui/material/Toolbar';
|
import Toolbar from '@mui/material/Toolbar';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import IconButton from '@mui/material/IconButton';
|
|
||||||
import Brightness4Icon from '@mui/icons-material/Brightness4';
|
|
||||||
import Brightness7Icon from '@mui/icons-material/Brightness7';
|
|
||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
|
|
||||||
const ColorModeContext = React.createContext({ toggleColorMode: () => { } });
|
const ColorModeContext = React.createContext({ toggleColorMode: () => { } });
|
||||||
|
|
||||||
interface HeaderProps {
|
const Header = (): JSX.Element => {
|
||||||
colorMode: {
|
|
||||||
toggleColorMode: () => void;
|
|
||||||
}
|
|
||||||
theme: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Header = (props: HeaderProps): JSX.Element => {
|
|
||||||
const theme = useTheme();
|
|
||||||
const colorMode = React.useContext(ColorModeContext);
|
|
||||||
return (
|
return (
|
||||||
<Box style={{ marginBottom: 60 }} sx={{ flexGrow: 1 }}>
|
<Box style={{ marginBottom: 60 }} sx={{ flexGrow: 1 }}>
|
||||||
<AppBar position="static">
|
<AppBar position="static">
|
||||||
@ -31,9 +19,6 @@ const Header = (props: HeaderProps): JSX.Element => {
|
|||||||
CoinGecko Data
|
CoinGecko Data
|
||||||
</Link>
|
</Link>
|
||||||
</Typography>
|
</Typography>
|
||||||
<IconButton sx={{ ml: 1 }} onClick={props.colorMode.toggleColorMode} color="inherit">
|
|
||||||
{props.theme.palette.mode === 'dark' ? <Brightness7Icon /> : <Brightness4Icon />}
|
|
||||||
</IconButton>
|
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import { Line } from 'react-chartjs-2';
|
|||||||
import { useGetCoinChartQuery } from '../coinApi';
|
import { useGetCoinChartQuery } from '../coinApi';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
|
|
||||||
|
import Box from '@mui/material/Box';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import ButtonGroup from '@mui/material/ButtonGroup';
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
||||||
import Grid from '@mui/material/Grid';
|
import Grid from '@mui/material/Grid';
|
||||||
@ -45,7 +46,6 @@ export interface IDurationOptions extends Array<IDurationOption> { }
|
|||||||
|
|
||||||
const CoinChart = (props: ICoinChartProps): JSX.Element => {
|
const CoinChart = (props: ICoinChartProps): JSX.Element => {
|
||||||
|
|
||||||
const ref = React.useRef<any>(null);
|
|
||||||
const [duration, setDuration] = React.useState('max')
|
const [duration, setDuration] = React.useState('max')
|
||||||
const [redraw, setRedraw] = React.useState(false);
|
const [redraw, setRedraw] = React.useState(false);
|
||||||
|
|
||||||
@ -117,10 +117,7 @@ const CoinChart = (props: ICoinChartProps): JSX.Element => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<Box>
|
||||||
ref={ref}
|
|
||||||
className="chart"
|
|
||||||
>
|
|
||||||
{
|
{
|
||||||
data && <>
|
data && <>
|
||||||
<Grid container justifyContent="flex-start" style={{ marginBottom: 20 }}>
|
<Grid container justifyContent="flex-start" style={{ marginBottom: 20 }}>
|
||||||
@ -150,7 +147,7 @@ const CoinChart = (props: ICoinChartProps): JSX.Element => {
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
</div>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { useGetCoinInfoQuery } from '../coinApi';
|
|||||||
|
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import Grid from '@mui/material/Grid';
|
import Grid from '@mui/material/Grid';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
|
||||||
import CoinChart from './coinChart';
|
import CoinChart from './coinChart';
|
||||||
import CoinStats from './coinStats';
|
import CoinStats from './coinStats';
|
||||||
@ -20,15 +21,16 @@ const CoinDetails = (): JSX.Element => {
|
|||||||
} = useGetCoinInfoQuery(id ? id : '');
|
} = useGetCoinInfoQuery(id ? id : '');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="details">
|
<Box>
|
||||||
{isLoading && <div>Loading...</div>}
|
{isLoading && <div>Loading...</div>}
|
||||||
{
|
{
|
||||||
data && isSuccess && <>
|
data && isSuccess && <>
|
||||||
<div className="details-title">
|
<Grid container style={{ marginBottom: 40 }}>
|
||||||
<img src={data.image.large} width="28" height="28" />
|
<Typography variant="h1">
|
||||||
<h1>{data.name}</h1>
|
<img src={data.image.large} width="28" height="28" style={{ marginRight: 10 }} />
|
||||||
</div>
|
{data.name}
|
||||||
<Box>
|
</Typography>
|
||||||
|
</Grid>
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<Grid item xs={12} sm={12} md={8}>
|
<Grid item xs={12} sm={12} md={8}>
|
||||||
<CoinInfo data={data} />
|
<CoinInfo data={data} />
|
||||||
@ -40,13 +42,13 @@ const CoinDetails = (): JSX.Element => {
|
|||||||
<CoinChart coin={data.id} />
|
<CoinChart coin={data.id} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} style={{ marginTop: 40 }}>
|
<Grid item xs={12} style={{ marginTop: 40 }}>
|
||||||
<div style={{lineHeight: 2}} dangerouslySetInnerHTML={{ __html: data.description.en }} />
|
<Typography variant="body2" dangerouslySetInnerHTML={{ __html: data.description.en }}></Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Box>
|
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
</div>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import TwitterIcon from '@mui/icons-material/Twitter';
|
|||||||
import LinkIcon from '@mui/icons-material/Link';
|
import LinkIcon from '@mui/icons-material/Link';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import Grid from '@mui/material/Grid';
|
import Grid from '@mui/material/Grid';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import Box from '@mui/material/Box';
|
||||||
|
|
||||||
import { ICoinInfoProps } from './coinDetails-types'
|
import { ICoinInfoProps } from './coinDetails-types'
|
||||||
|
|
||||||
@ -14,8 +16,8 @@ const CoinInfo = (props: ICoinInfoProps): JSX.Element => {
|
|||||||
console.log("CoinInfo props.data: ", data)
|
console.log("CoinInfo props.data: ", data)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<Box>
|
||||||
<h2>Info</h2>
|
<Typography variant="h2">Info</Typography>
|
||||||
<Grid container justifyContent="flex-start">
|
<Grid container justifyContent="flex-start">
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
Rank: #{data.market_cap_rank}
|
Rank: #{data.market_cap_rank}
|
||||||
@ -66,7 +68,7 @@ const CoinInfo = (props: ICoinInfoProps): JSX.Element => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,8 @@ import TableBody from '@mui/material/TableBody';
|
|||||||
import TableCell from '@mui/material/TableCell';
|
import TableCell from '@mui/material/TableCell';
|
||||||
import TableContainer from '@mui/material/TableContainer';
|
import TableContainer from '@mui/material/TableContainer';
|
||||||
import TableRow from '@mui/material/TableRow';
|
import TableRow from '@mui/material/TableRow';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import Box from '@mui/material/Box';
|
||||||
|
|
||||||
import { ICoinStatsProps, ICoinInfoProps, IStatsRow } from './coinDetails-types'
|
import { ICoinStatsProps, ICoinInfoProps, IStatsRow } from './coinDetails-types'
|
||||||
|
|
||||||
@ -24,8 +26,8 @@ const CoinStats = (props: ICoinStatsProps): JSX.Element => {
|
|||||||
]
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="info-stats">
|
<Box>
|
||||||
<h2>Statistics</h2>
|
<Typography variant="h2">Statistics</Typography>
|
||||||
<TableContainer>
|
<TableContainer>
|
||||||
<Table size="small" >
|
<Table size="small" >
|
||||||
<TableBody>
|
<TableBody>
|
||||||
@ -40,7 +42,7 @@ const CoinStats = (props: ICoinStatsProps): JSX.Element => {
|
|||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
</TableContainer>
|
</TableContainer>
|
||||||
</div>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
|
import Box from '@mui/material/Box';
|
||||||
import Table from '@mui/material/Table';
|
import Table from '@mui/material/Table';
|
||||||
import TableBody from '@mui/material/TableBody';
|
import TableBody from '@mui/material/TableBody';
|
||||||
import TableCell from '@mui/material/TableCell';
|
import TableCell from '@mui/material/TableCell';
|
||||||
@ -26,7 +27,7 @@ const CoinList = (): JSX.Element => {
|
|||||||
const { data: globalData, isLoading: globalIsLoading, isSuccess: lobalSuccess } = useGetGlobalQuery();
|
const { data: globalData, isLoading: globalIsLoading, isSuccess: lobalSuccess } = useGetGlobalQuery();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="coin-list">
|
<Box className="coin-list">
|
||||||
{isLoading || globalIsLoading && <div>Loading...</div>}
|
{isLoading || globalIsLoading && <div>Loading...</div>}
|
||||||
{
|
{
|
||||||
globalData &&
|
globalData &&
|
||||||
@ -117,7 +118,7 @@ const CoinList = (): JSX.Element => {
|
|||||||
</TableContainer>
|
</TableContainer>
|
||||||
}
|
}
|
||||||
<Pager page={page} per_page={per_page}/>
|
<Pager page={page} per_page={per_page}/>
|
||||||
</div>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,15 +10,13 @@ body {
|
|||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #1976d2;
|
color: #44a37d;
|
||||||
}
|
}
|
||||||
|
|
||||||
.coin-list a {
|
.coin-list a {
|
||||||
color: #444444;
|
color: #444444;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 { color: #888888; font-weight: lighter;}
|
|
||||||
|
|
||||||
header a {
|
header a {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@ -44,31 +42,3 @@ header a {
|
|||||||
color: #777777;
|
color: #777777;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.globalText {
|
|
||||||
font-weight: normal;
|
|
||||||
font-size: 0.9em;
|
|
||||||
font-style: italic;
|
|
||||||
margin-left: 5px;
|
|
||||||
color: #777777;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart-container {
|
|
||||||
height: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.details-title {
|
|
||||||
display:flex;
|
|
||||||
align-items:center;
|
|
||||||
justify-content:start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.details-title img {
|
|
||||||
margin-right: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.details h2 {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
Loading…
x
Reference in New Issue
Block a user