React/Material-UIのCardでカウントアップ
12218 ワード
react-countup
で実装。
./src/App.js
import logo from "./logo.svg";
import "./App.css";
import { Card, CardContent, Grid, Typography } from "@material-ui/core";
import LocalHospitalIcon from "@material-ui/icons/LocalHospital";
import CloseIcon from "@material-ui/icons/Close";
import DirectionsRunIcon from "@material-ui/icons/DirectionsRun";
import FavoriteIcon from "@material-ui/icons/Favorite";
import CountUp from "react-countup";
function App() {
return (
<div>
<Grid container spacing={1}>
<Grid item xs={3} color="primary">
<Card style={{ backgroundColor: "#0095d9" }}>
<CardContent>
<Typography variant="h5">
<CountUp start={622273 - 1000} end={622273} separator="," />
</Typography>
<Typography>
<LocalHospitalIcon />
Confirmed
</Typography>
</CardContent>
</Card>
</Grid>
<Grid item xs={3}>
<Card style={{ backgroundColor: "#e60033" }}>
<CardContent>
<Typography variant="h5">
<CountUp start={10566 - 1000} end={10566} separator="," />
</Typography>
<Typography>
<CloseIcon />
Deaths
</Typography>
</CardContent>
</Card>
</Grid>
<Grid item xs={3}>
<Card style={{ backgroundColor: "#3eb370" }}>
<CardContent>
<Typography variant="h5">
<CountUp start={542413 - 1000} end={542413} separator="," />
</Typography>
<Typography>
<DirectionsRunIcon />
Recovered
</Typography>
</CardContent>
</Card>
</Grid>
<Grid item xs={3}>
<Card style={{ backgroundColor: "#ffd900" }}>
<CardContent>
<Typography variant="h5">
<CountUp start={69294 - 1000} end={69294} separator="," />
</Typography>
<Typography>
<FavoriteIcon />
Active
</Typography>
</CardContent>
</Card>
</Grid>
</Grid>
</div>
);
}
export default App;
Author And Source
この問題について(React/Material-UIのCardでカウントアップ), 我々は、より多くの情報をここで見つけました https://qiita.com/yono2844/items/1334e03c5fb7880cd08b著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .