-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathStatisticsTab.jsx
More file actions
50 lines (47 loc) · 1.24 KB
/
StatisticsTab.jsx
File metadata and controls
50 lines (47 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import styles from './StatisticsTab.module.css';
function StatisticsTab(props) {
const {
title,
number,
percentageChange,
type,
isIncreased,
tabBackgroundColor,
shapeBackgroundColor,
comparisonType,
} = props;
return (
<div
className={styles.statisticsTabHolder}
style={{ backgroundColor: tabBackgroundColor }}
role="region"
aria-labelledby={`${type}-title`}
>
<h3 className={styles.statisticsTitle} id={`${type}-title`}>
{title}
</h3>
<div
className={styles.statisticsNumberShape}
style={{ backgroundColor: shapeBackgroundColor }}
role="figure"
aria-labelledby={`${type}-number`}
>
<h3 className={styles.statisticsNumber} id={`${type}-number`}>
{number}
</h3>
</div>
{comparisonType !== 'No Comparison' && (
<h4
className={`${styles.statisticsPercentage} ${
isIncreased ? styles.statisticsPercentageIncrease : styles.statisticsPercentageDecrease
}`}
aria-live="polite"
>
{isIncreased ? '+' : '-'}
{percentageChange}% {comparisonType.toLowerCase()}
</h4>
)}
</div>
);
}
export default StatisticsTab;