Skip to content

Commit fee5f26

Browse files
committed
fix: darkmode
1 parent ccc3686 commit fee5f26

File tree

4 files changed

+87
-179
lines changed

4 files changed

+87
-179
lines changed

src/components/Hints/Hints.module.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,90 @@
1515
pointer-events: none;
1616
}
1717

18+
/* Chart and Legend Styles */
19+
.chartBackground {
20+
background-color: var(--sapBackgroundColor, #fafafa);
21+
}
22+
23+
.chartLabel {
24+
color: var(--sapTextColor, #374151);
25+
}
26+
27+
.legendSection {
28+
background-color: var(--sapTile_Background, #ffffff);
29+
border: 1px solid var(--sapList_BorderColor, #e1e5e9);
30+
color: var(--sapTextColor, #374151);
31+
box-shadow: var(--sapContent_Shadow1, 0 1px 3px rgba(0, 0, 0, 0.1));
32+
}
33+
34+
.legendTitle {
35+
color: var(--sapTitleColor, var(--sapTextColor, #374151));
36+
}
37+
38+
.legendItem {
39+
color: var(--sapContent_LabelColor, #6b7280);
40+
}
41+
1842
/* Dark mode support */
1943
@media (prefers-color-scheme: dark) {
2044
.disabledOverlay {
2145
background: rgba(0, 0, 0, 0.4);
2246
}
47+
48+
.chartBackground {
49+
background-color: #2a2a2a;
50+
}
51+
52+
.chartLabel {
53+
color: #ffffff;
54+
}
55+
56+
.legendSection {
57+
background-color: #2a2a2a;
58+
border-color: #404040;
59+
color: #ffffff;
60+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
61+
}
62+
63+
.legendTitle {
64+
color: #ffffff;
65+
}
66+
67+
.legendItem {
68+
color: #cccccc;
69+
}
2370
}
2471

2572
/* Also check for UI5 theme variables for dark themes */
2673
[data-ui5-theme-root*="dark"] .disabledOverlay,
2774
[data-ui5-theme*="dark"] .disabledOverlay {
2875
background: rgba(0, 0, 0, 0.4);
76+
}
77+
78+
[data-ui5-theme-root*="dark"] .chartBackground,
79+
[data-ui5-theme*="dark"] .chartBackground {
80+
background-color: #2a2a2a;
81+
}
82+
83+
[data-ui5-theme-root*="dark"] .chartLabel,
84+
[data-ui5-theme*="dark"] .chartLabel {
85+
color: #ffffff;
86+
}
87+
88+
[data-ui5-theme-root*="dark"] .legendSection,
89+
[data-ui5-theme*="dark"] .legendSection {
90+
background-color: #2a2a2a;
91+
border-color: #404040;
92+
color: #ffffff;
93+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
94+
}
95+
96+
[data-ui5-theme-root*="dark"] .legendTitle,
97+
[data-ui5-theme*="dark"] .legendTitle {
98+
color: #ffffff;
99+
}
100+
101+
[data-ui5-theme-root*="dark"] .legendItem,
102+
[data-ui5-theme*="dark"] .legendItem {
103+
color: #cccccc;
29104
}

src/components/Hints/LegendSection.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import styles from './Hints.module.css';
23

34
interface LegendItem {
45
label: string;
@@ -18,22 +19,18 @@ export const LegendSection: React.FC<LegendSectionProps> = ({
1819
style
1920
}) => {
2021
return (
21-
<div style={{
22+
<div className={styles.legendSection} style={{
2223
marginBottom: '1rem',
2324
padding: '0.75rem',
2425
borderRadius: '6px',
25-
backgroundColor: 'white',
26-
border: '1px solid #e1e5e9',
27-
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.1)',
2826
width: 'fit-content',
2927
margin: '0 auto 1rem auto',
3028
...style
3129
}}>
32-
<div style={{
30+
<div className={styles.legendTitle} style={{
3331
fontSize: '0.95rem',
3432
fontWeight: '600',
3533
marginBottom: '0.5rem',
36-
color: '#374151',
3734
textAlign: 'center'
3835
}}>
3936
{title}
@@ -56,7 +53,7 @@ export const LegendSection: React.FC<LegendSectionProps> = ({
5653
backgroundColor: item.color,
5754
borderRadius: '50%'
5855
}} />
59-
<span style={{ fontSize: '0.85rem', color: '#6b7280' }}>
56+
<span className={styles.legendItem} style={{ fontSize: '0.85rem' }}>
6057
{item.count} {item.label}
6158
</span>
6259
</div>

src/components/Hints/MultiPercentageBar.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useEffect, useRef, useState, useMemo } from 'react';
2+
import styles from './Hints.module.css';
23

34
interface PercentageSegment {
45
percentage: number;
@@ -40,7 +41,7 @@ export const MultiPercentageBar: React.FC<MultiPercentageBarProps> = ({
4041
labelFontSize = '0.875rem',
4142
gap = '2px',
4243
borderRadius = '6px',
43-
backgroundColor = '#e9e9e9ff',
44+
backgroundColor, // Remove default value to use CSS class
4445
className,
4546
style,
4647
animationDuration = 600, // Default 600ms animation
@@ -216,17 +217,17 @@ export const MultiPercentageBar: React.FC<MultiPercentageBarProps> = ({
216217
}}>
217218
<div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
218219
{showPercentage && (
219-
<span style={{
220+
<span className={`${styles.chartLabel} ${allHealthy ? '' : ''}`} style={{
220221
fontSize: labelFontSize,
221-
color: allHealthy ? 'green' : 'black',
222+
color: allHealthy ? 'green' : undefined,
222223
fontWeight: allHealthy ? '700' : '400'
223224
}}>
224225
{displayPrimaryPercentage}%
225226
</span>
226227
)}
227-
<span style={{
228+
<span className={`${styles.chartLabel} ${allHealthy ? '' : ''}`} style={{
228229
fontSize: labelFontSize,
229-
color: allHealthy ? 'green' : 'black',
230+
color: allHealthy ? 'green' : undefined,
230231
fontWeight: allHealthy ? '700' : '400'
231232
}}>
232233
{displayLabel}
@@ -236,12 +237,12 @@ export const MultiPercentageBar: React.FC<MultiPercentageBarProps> = ({
236237
)}
237238

238239
{/* Colored bars */}
239-
<div style={{
240+
<div className={styles.chartBackground} style={{
240241
display: 'flex',
241242
gap,
242243
width: barWidth,
243244
maxWidth: barMaxWidth,
244-
backgroundColor,
245+
...(backgroundColor && { backgroundColor }), // Only override if explicitly provided
245246
borderRadius,
246247
padding: '2px',
247248
opacity: isVisible ? 1 : 0,

src/components/Hints/constants.spec.ts

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)