Skip to content

Commit cdc0dea

Browse files
Merge pull request #4506 from OneCommunityGlobal/Aditya-fix/dark-mode-statistics-card-text-contrast
Aditya-Fix: Improve dark mode text contrast in Total Org Summary statistics cards
2 parents e4f2a07 + 45ce07b commit cdc0dea

2 files changed

Lines changed: 45 additions & 36 deletions

File tree

src/components/TotalOrgSummary/StatisticsTab/StatisticsTab.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import './StatisticsTab.css';
1+
import styles from './StatisticsTab.module.css';
22

33
function StatisticsTab(props) {
44
const {
@@ -14,28 +14,28 @@ function StatisticsTab(props) {
1414

1515
return (
1616
<div
17-
className="statistics-tab-holder"
17+
className={styles.statisticsTabHolder}
1818
style={{ backgroundColor: tabBackgroundColor }}
1919
role="region"
2020
aria-labelledby={`${type}-title`}
2121
>
22-
<h3 className="statistics-title" id={`${type}-title`}>
22+
<h3 className={styles.statisticsTitle} id={`${type}-title`}>
2323
{title}
2424
</h3>
2525
<div
26-
className="statistics-number-shape"
26+
className={styles.statisticsNumberShape}
2727
style={{ backgroundColor: shapeBackgroundColor }}
2828
role="figure"
2929
aria-labelledby={`${type}-number`}
3030
>
31-
<h3 className="statistics-number" id={`${type}-number`}>
31+
<h3 className={styles.statisticsNumber} id={`${type}-number`}>
3232
{number}
3333
</h3>
3434
</div>
3535
{comparisonType !== 'No Comparison' && (
3636
<h4
37-
className={`statistics-percentage ${
38-
isIncreased ? 'statistics-percentage-increase' : 'statistics-percentage-decrease'
37+
className={`${styles.statisticsPercentage} ${
38+
isIncreased ? styles.statisticsPercentageIncrease : styles.statisticsPercentageDecrease
3939
}`}
4040
aria-live="polite"
4141
>

src/components/TotalOrgSummary/StatisticsTab/StatisticsTab.css renamed to src/components/TotalOrgSummary/StatisticsTab/StatisticsTab.module.css

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
--color-increase-percentage: #328d1b;
1414
}
1515

16-
.statistics-tab-holder {
16+
.statisticsTabHolder {
1717
display: flex;
1818
flex-direction: column;
1919
justify-content: center;
@@ -30,32 +30,41 @@
3030
margin: 0.5rem;
3131
}
3232

33-
3433
/* Light mode (default) */
35-
.statistics-title {
34+
.statisticsTitle {
3635
color: #000000;
3736
font-size: larger;
3837
text-align: center;
3938
}
4039

41-
42-
43-
4440
/* All text and numbers inside the statistics boxes are black */
45-
.statistics-title,
46-
.statistics-number,
47-
.statistics-percentage {
41+
.statisticsTitle,
42+
.statisticsNumber,
43+
.statisticsPercentage {
44+
color: #000 !important;
45+
}
46+
47+
/* Override white text in dark mode - keep statistics card text black for contrast with light card backgrounds */
48+
/* This needs to be more specific than the rule in TotalOrgSummary.module.css line 17 */
49+
/* Using .statisticsTabHolder to increase specificity and target only the card content */
50+
:global(.bg-oxford-blue) .statisticsTabHolder .statisticsTitle,
51+
:global(.bg-oxford-blue) .statisticsTabHolder .statisticsNumber,
52+
:global(.bg-oxford-blue) .statisticsTabHolder .statisticsPercentage,
53+
:global(.bg-oxford-blue) .statisticsTabHolder h3.statisticsTitle,
54+
:global(.bg-oxford-blue) .statisticsTabHolder h3.statisticsNumber,
55+
:global(.bg-oxford-blue) .statisticsTabHolder h4.statisticsPercentage {
4856
color: #000 !important;
4957
}
5058

5159
/* Section headers above the boxes remain white in dark mode for contrast */
52-
.bg-oxford-blue .volunteerStatusGrid h3,
53-
.bg-oxford-blue .componentContainer h3,
54-
.bg-oxford-blue .statistics-section-title {
60+
/* Note: volunteerStatusGrid and componentContainer are from TotalOrgSummary.module.css, so they need :global() */
61+
:global(.bg-oxford-blue) :global(.volunteerStatusGrid) h3,
62+
:global(.bg-oxford-blue) :global(.componentContainer) h3,
63+
:global(.bg-oxford-blue) :global(.statistics-section-title) {
5564
color: #fff !important;
5665
}
5766

58-
.statistics-number-shape {
67+
.statisticsNumberShape {
5968
height: 3.6rem;
6069
width: 5rem;
6170
display: flex;
@@ -64,66 +73,66 @@
6473
border-radius: 50%;
6574
}
6675

67-
68-
.statistics-number {
76+
.statisticsNumber {
6977
color: #000000;
7078
}
7179

72-
.statistics-percentage {
80+
.statisticsPercentage {
7381
margin-top: 0.75rem;
7482
font-size: medium;
7583
}
7684

77-
78-
.statistics-percentage-increase {
85+
.statisticsPercentageIncrease {
7986
color: var(--color-increase-percentage);
8087
}
81-
.statistics-percentage-decrease {
88+
89+
.statisticsPercentageDecrease {
8290
color: var(--color-decrease-percentage);
8391
}
8492

85-
.active-volunteers-tab-bg-color {
93+
.activeVolunteersTabBgColor {
8694
background-color: var(--color-active-volunteers-tab-bg);
8795
}
8896

89-
.active-volunteers-shape-bg-color {
97+
.activeVolunteersShapeBgColor {
9098
background-color: var(--color-active-volunteers-shape-bg);
9199
}
92100

93-
.new-volunteers-tab-bg-color {
101+
.newVolunteersTabBgColor {
94102
background-color: var(--color-new-volunteers-tab-bg);
95103
}
96104

97-
.new-volunteers-shape-bg-color {
105+
.newVolunteersShapeBgColor {
98106
background-color: var(--color-new-volunteers-shape-bg);
99107
}
100108

101-
.deactivated-volunteers-tab-bg-color {
109+
.deactivatedVolunteersTabBgColor {
102110
background-color: var(--color-deactivated-volunteers-tab-bg);
103111
}
104112

105-
.deactivated-volunteers-shape-bg-color {
113+
.deactivatedVolunteersShapeBgColor {
106114
background-color: var(--color-deactivated-volunteers-shape-bg);
107115
}
108116

109-
.total-hours-worked-tab-bg-color {
117+
.totalHoursWorkedTabBgColor {
110118
background-color: var(--color-total-hours-worked-tab-bg);
111119
}
112120

113-
.total-hours-worked-shape-bg-color {
121+
.totalHoursWorkedShapeBgColor {
114122
background-color: var(--color-total-hours-worked-shape-bg);
115123
}
116124

117125
@media (max-width: 768px) {
118-
.statistics-tab-holder {
126+
.statisticsTabHolder {
119127
width: 48%;
120128
margin: 1%;
121129
}
122130
}
123131

124132
@media (max-width: 480px) {
125-
.statistics-tab-holder {
133+
.statisticsTabHolder {
126134
width: 100%;
127135
margin: 0.5rem 0;
128136
}
129137
}
138+

0 commit comments

Comments
 (0)