Skip to content

Commit 239a966

Browse files
author
NarrowsProjects
committed
feat: creation of warningComponent
1 parent 8cfb430 commit 239a966

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

lib/public/app.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ th.text-center, td.text-center {
266266
border-color: #f5c6cb;
267267
}
268268

269+
.alert-warning {
270+
color: var(--color-warning);
271+
background-color: #f8d7da;
272+
border-color: #f5c6cb;
273+
}
274+
269275
.alert-danger hr {
270276
border-top-color: #f1b0b7;
271277
}
@@ -712,6 +718,24 @@ label {
712718
opacity: 0.5;
713719
}
714720

721+
.btn.btn-warning { background-color: var(--color-warning); color: var(--color-white); }
722+
723+
.pulse-red {
724+
animation: pulseRed 2s infinite;
725+
}
726+
727+
@keyframes pulseRed {
728+
0% {
729+
box-shadow: 0 0 0px rgba(255, 69, 7, 0.6);
730+
}
731+
50% {
732+
box-shadow: 0 0 10px rgba(255, 69, 7, 0.9);
733+
}
734+
100% {
735+
box-shadow: 0 0 0px rgba(255, 69, 7, 0.6);
736+
}
737+
}
738+
715739
/**
716740
* Breakpoints :
717741
* small : x < 600 (default styles)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { DropdownComponent, h } from '/js/src/index.js';
2+
3+
/**
4+
* Component to display whenever a page has warnings.
5+
*
6+
* @param {Array<(string, string)>} warnings an array of warnings and messages
7+
* @returns {Component} the warning componen
8+
*/
9+
export const warningComponent = (warnings) => {
10+
if (!warnings.length) {
11+
return null;
12+
}
13+
14+
return DropdownComponent(
15+
h('.btn.btn-warning.white.pulse-red', 'Warnings'),
16+
h('.flex-column.p2.g2.black', warnings.map(([key, message]) => `${key}: ${message}`)),
17+
);
18+
};

0 commit comments

Comments
 (0)