Skip to content

Commit fd2c3e9

Browse files
committed
fix(ui): add light mode colors to warning alert
1 parent 73542c5 commit fd2c3e9

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

  • testgen/ui/components/frontend/js/components

testgen/ui/components/frontend/js/components/alert.js

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @property {string?} icon
55
* @property {number?} timeout
66
* @property {boolean?} closeable
7-
* @property {'info'|'success'|'error'} type
7+
* @property {'info'|'success'|'warn'|'error'} type
88
*/
99
import van from '../van.min.js';
1010
import { getValue, loadStylesheet, getRandomId } from '../utils.js';
@@ -35,11 +35,7 @@ const Alert = (/** @type Properties */ props, /** @type Array<HTMLElement> */ ..
3535
{
3636
...props,
3737
id: elementId,
38-
class: () => (getValue(props.class) ?? '') + ` tg-alert flex-row`,
39-
style: () => {
40-
const colors = alertTypeColors[getValue(props.type)];
41-
return `color: ${colors.color}; background-color: ${colors.backgroundColor};`;
42-
},
38+
class: () => `tg-alert flex-row ${getValue(props.class) ?? ''} tg-alert-${getValue(props.type)}`,
4339
role: 'alert',
4440
},
4541
() => {
@@ -74,6 +70,34 @@ stylesheet.replace(`
7470
font-size: 16px;
7571
line-height: 24px;
7672
}
73+
74+
.tg-alert-info {
75+
background-color: rgba(28, 131, 225, 0.1);
76+
color: rgb(0, 66, 128);
77+
}
78+
79+
.tg-alert-success {
80+
background-color: rgba(33, 195, 84, 0.1);
81+
color: rgb(23, 114, 51);
82+
}
83+
84+
.tg-alert-error {
85+
background-color: rgba(255, 43, 43, 0.09);
86+
color: rgb(125, 53, 59);
87+
}
88+
89+
.tg-alert-warn {
90+
background-color: rgba(255, 227, 18, 0.1);
91+
color: rgb(146, 108, 5);
92+
}
93+
94+
@media (prefers-color-scheme: dark) {
95+
.tg-alert-warn {
96+
background-color: rgba(255, 227, 18, 0.2);
97+
color: rgb(255, 255, 194);
98+
}
99+
}
100+
77101
.tg-alert > .tg-icon {
78102
color: inherit !important;
79103
}

0 commit comments

Comments
 (0)