From 50548db9ead5b6116f8fdfa43bd635c5bfb27509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Wed, 25 May 2022 06:39:09 +0400 Subject: [PATCH] Create Stats components --- components/stats/bar-stats.js | 36 ++++++++++++++++++++++++ components/stats/kat-stats.js | 24 ++++++++++++++++ components/stats/traductions-stats.js | 40 +++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 components/stats/bar-stats.js create mode 100644 components/stats/kat-stats.js create mode 100644 components/stats/traductions-stats.js diff --git a/components/stats/bar-stats.js b/components/stats/bar-stats.js new file mode 100644 index 0000000..91295c6 --- /dev/null +++ b/components/stats/bar-stats.js @@ -0,0 +1,36 @@ +import PropTypes from 'prop-types' +import {styled} from '@mui/material/styles' +import Typography from '@mui/material/Typography' +import Box from '@mui/material/Box' +import LinearProgress, {linearProgressClasses} from '@mui/material/LinearProgress' + +const BorderLinearProgress = styled(LinearProgress)(({theme}) => ({ + height: 10, + borderRadius: 5, + [`&.${linearProgressClasses.colorPrimary}`]: { + backgroundColor: theme.palette.grey[theme.palette.mode === 'light' ? 200 : 800], + }, + [`& .${linearProgressClasses.bar}`]: { + borderRadius: 5, + backgroundColor: theme.palette.mode === 'light' ? '#1a90ff' : '#308fe8', + }, +})) + +export default function BarStats({percent}) { + return ( + + + + + + {`${Math.round( + percent, + )}%`} + + + ) +} + +BarStats.propTypes = { + percent: PropTypes.number.isRequired, +} diff --git a/components/stats/kat-stats.js b/components/stats/kat-stats.js new file mode 100644 index 0000000..b8a1ef7 --- /dev/null +++ b/components/stats/kat-stats.js @@ -0,0 +1,24 @@ +import PropTypes from 'prop-types' +import Card from '@mui/material/Card' +import CardContent from '@mui/material/CardContent' +import Typography from '@mui/material/Typography' +import TraductionsStats from './traductions-stats' + +export default function KatStats({emoji, value, total}) { + return ( + + + + + + + + + ) +} + +KatStats.propTypes = { + emoji: PropTypes.string.isRequired, + value: PropTypes.number.isRequired, + total: PropTypes.number.isRequired +} diff --git a/components/stats/traductions-stats.js b/components/stats/traductions-stats.js new file mode 100644 index 0000000..9497ab2 --- /dev/null +++ b/components/stats/traductions-stats.js @@ -0,0 +1,40 @@ +import PropTypes from 'prop-types' +import Typography from '@mui/material/Typography' +import Box from '@mui/material/Box' +import Grid from '@mui/material/Grid' + +import BarStats from './bar-stats' + +export default function TraductionsStats({value, total}) { + const translated = total - value + const percent = (translated / total) * 100 + + return ( + + + + + {translated} + + + Paroles traduites + + + + + {value} + + + Paroles non traduites + + + + + + ) +} + +TraductionsStats.propTypes = { + value: PropTypes.number.isRequired, + total: PropTypes.number.isRequired +}