Skip to content

Commit 9d1d6a7

Browse files
changes
1 parent 71b0471 commit 9d1d6a7

File tree

1 file changed

+33
-12
lines changed

1 file changed

+33
-12
lines changed

packages/compass-global-writes/src/plugin-title.tsx

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,34 @@ const importantIconStylesDark = css({
3838
color: palette.red.base,
3939
});
4040

41+
const ErrorIcon = ({ darkMode }: { darkMode: boolean }) => {
42+
return (
43+
<Icon
44+
glyph="Warning"
45+
aria-label="warning"
46+
className={cx(
47+
warningIconStyles,
48+
warningIconStylesLight,
49+
darkMode && warningIconStylesDark
50+
)}
51+
/>
52+
);
53+
};
54+
55+
const WarningIcon = ({ darkMode }: { darkMode: boolean }) => {
56+
return (
57+
<Icon
58+
glyph="ImportantWithCircle"
59+
aria-label="important"
60+
className={cx(
61+
warningIconStyles,
62+
importantIconStylesLight,
63+
darkMode && importantIconStylesDark
64+
)}
65+
/>
66+
);
67+
};
68+
4169
export const PluginTitle = ({
4270
showError,
4371
showWarning,
@@ -62,18 +90,11 @@ export const PluginTitle = ({
6290
// so we add noop onClick and let it bubble up.
6391
}}
6492
>
65-
<Icon
66-
glyph={showError ? 'Warning' : 'ImportantWithCircle'}
67-
aria-label={showError ? 'warning' : 'important'}
68-
className={cx(
69-
warningIconStyles,
70-
showError ? warningIconStylesLight : importantIconStylesLight,
71-
darkMode &&
72-
(showError
73-
? warningIconStylesDark
74-
: importantIconStylesDark)
75-
)}
76-
/>
93+
{showError ? (
94+
<ErrorIcon darkMode={darkMode} />
95+
) : (
96+
<WarningIcon darkMode={darkMode} />
97+
)}
7798
</span>
7899
}
79100
>

0 commit comments

Comments
 (0)