Skip to content

Commit 6b9cb2e

Browse files
feat: [IAC-5075]: dark theme support
1 parent 7ba6efa commit 6b9cb2e

File tree

3 files changed

+25
-27
lines changed

3 files changed

+25
-27
lines changed

plugins/harness-iacm/src/components/WorkspaceList/ResourceDetailDrawer/AttributeList.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,11 @@ const AttributeList: React.FC<AttributeListProps> = ({
6060
<Box className={classes.valueComparison}>
6161
<ValueDisplay
6262
value={driftValue}
63-
isDrift
6463
label="Actual Value:"
6564
copyTopOffset="25px"
6665
/>
6766
<ValueDisplay
6867
value={item.value}
69-
isDrift
7068
label="Expected Value:"
7169
copyTopOffset="25px"
7270
/>

plugins/harness-iacm/src/components/WorkspaceList/ResourceDetailDrawer/ValueDisplay.tsx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ const useStyles = makeStyles(theme => ({
1010
borderRadius: 4,
1111
overflow: 'auto',
1212
marginTop: theme.spacing(0.5),
13-
border: '1px solid #e0e0e0',
13+
border: `1px solid ${theme.palette.divider}`,
1414
fontFamily: 'inherit',
15+
backgroundColor:
16+
theme.palette.type === 'dark'
17+
? theme.palette.background.default
18+
: '#F3F3FA',
1519
},
1620
attributeValue: {
1721
fontSize: '1rem',
1822
fontWeight: 400,
19-
color: '#212121',
23+
color: theme.palette.text.primary,
2024
flex: 1,
2125
wordBreak: 'break-word',
2226
fontFamily: 'inherit',
@@ -35,47 +39,40 @@ const useStyles = makeStyles(theme => ({
3539
stringValue: {
3640
padding: '8px',
3741
borderRadius: 4,
38-
border: '1px solid #e0e0e0',
42+
border: `1px solid ${theme.palette.divider}`,
3943
fontFamily: 'inherit',
44+
backgroundColor:
45+
theme.palette.type === 'dark'
46+
? theme.palette.background.default
47+
: '#F3F3FA',
4048
},
4149
}));
4250

4351
interface ValueDisplayProps {
4452
value: any;
45-
isDrift?: boolean;
4653
showCopy?: boolean;
4754
label?: string;
4855
copyTopOffset?: string;
4956
}
5057

5158
export const formatValueDisplay = (
5259
value: any,
53-
isDrift: boolean = false,
5460
classes: any,
5561
): React.ReactNode => {
5662
if (typeof value === 'object') {
5763
return (
58-
<pre
59-
className={classes.jsonValue}
60-
style={{ backgroundColor: isDrift ? '' : '#F3F3FA' }}
61-
>
62-
{JSON.stringify(value, null, 2)}
63-
</pre>
64+
<pre className={classes.jsonValue}>{JSON.stringify(value, null, 2)}</pre>
6465
);
6566
}
6667
return (
67-
<div
68-
className={classes.stringValue}
69-
style={{ backgroundColor: isDrift ? '' : '#F3F3FA' }}
70-
>
68+
<div className={classes.stringValue}>
7169
{isValueUnknown(value) ? 'Unknown' : String(value)}
7270
</div>
7371
);
7472
};
7573

7674
const ValueDisplay: React.FC<ValueDisplayProps> = ({
7775
value,
78-
isDrift = false,
7976
showCopy = true,
8077
label,
8178
copyTopOffset,
@@ -93,7 +90,7 @@ const ValueDisplay: React.FC<ValueDisplayProps> = ({
9390
</Box>
9491
)}
9592
{label && <Typography className={classes.valueLabel}>{label}</Typography>}
96-
{formatValueDisplay(value, isDrift, classes)}
93+
{formatValueDisplay(value, classes)}
9794
</Box>
9895
);
9996
};

plugins/harness-iacm/src/components/WorkspaceList/ResourceDetailDrawer/styles.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,31 @@ export const useStyles = makeStyles(theme => ({
7676
color: theme.palette.text.secondary,
7777
},
7878
attributeRow: {
79-
backgroundColor: '#ffffff',
80-
border: '1px solid #e0e0e0',
79+
backgroundColor: theme.palette.background.paper,
80+
border: `1px solid ${theme.palette.divider}`,
8181
borderRadius: 4,
8282
marginBottom: theme.spacing(1),
8383
padding: theme.spacing(1.5),
8484
paddingBottom: theme.spacing(1),
8585
position: 'relative',
8686
},
8787
attributeRowDrift: {
88-
backgroundColor: '#fff3e0',
88+
backgroundColor:
89+
theme.palette.type === 'dark' ? 'rgba(255, 183, 77, 0.1)' : '#fff3e0',
8990
borderColor: '#ffb74d',
9091
},
9192
attributeKey: {
9293
fontWeight: 500,
9394
marginBottom: theme.spacing(0.75),
94-
color: '#424242',
95+
color: theme.palette.text.primary,
9596
display: 'flex',
9697
alignItems: 'center',
9798
gap: theme.spacing(0.5),
9899
fontFamily: 'inherit',
99100
},
100101
attributeValue: {
101102
fontWeight: 400,
102-
color: '#212121',
103+
color: theme.palette.text.primary,
103104
flex: 1,
104105
wordBreak: 'break-word',
105106
fontFamily: 'inherit',
@@ -109,14 +110,16 @@ export const useStyles = makeStyles(theme => ({
109110
borderRadius: 4,
110111
overflow: 'auto',
111112
marginTop: theme.spacing(0.5),
112-
border: '1px solid #e0e0e0',
113+
border: `1px solid ${theme.palette.divider}`,
113114
fontFamily: 'inherit',
114115
},
115116
deletedBadge: {
116117
fontWeight: 600,
117118
textTransform: 'uppercase',
118-
backgroundColor: '#ffebee',
119-
119+
backgroundColor:
120+
theme.palette.type === 'dark' ? 'rgba(244, 67, 54, 0.2)' : '#ffebee',
121+
color:
122+
theme.palette.type === 'dark' ? '#ffcdd2' : theme.palette.text.primary,
120123
padding: '2px 6px',
121124
borderRadius: 4,
122125
display: 'inline-flex',

0 commit comments

Comments
 (0)