alerts now with solid bgcolor and icons
This commit is contained in:
parent
b9ba2167aa
commit
57c313702c
@ -26,16 +26,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeAlert(alertEl) {
|
function makeAlert(alertEl) {
|
||||||
|
var iconEl = document.createElement('DIV');
|
||||||
var closeEl = document.createElement('DIV');
|
var closeEl = document.createElement('DIV');
|
||||||
var dataDecay = alertEl.dataset.decay;
|
var dataDecay = alertEl.dataset.decay;
|
||||||
var autoDecay = 30;
|
var autoDecay = 30;
|
||||||
if (dataDecay) {
|
if (dataDecay) {
|
||||||
autoDecay = parseInt(dataDecay, 10);
|
autoDecay = parseInt(dataDecay, 10);
|
||||||
}
|
}
|
||||||
|
iconEl.classList.add('alert__icon');
|
||||||
closeEl.classList.add('alert__close');
|
closeEl.classList.add('alert__close');
|
||||||
closeEl.addEventListener('click', function(event) {
|
closeEl.addEventListener('click', function(event) {
|
||||||
closeAlert(alertEl);
|
closeAlert(alertEl);
|
||||||
});
|
});
|
||||||
|
alertEl.insertBefore(iconEl, alertEl.children[0]);
|
||||||
alertEl.insertBefore(closeEl, alertEl.children[0]);
|
alertEl.insertBefore(closeEl, alertEl.children[0]);
|
||||||
|
|
||||||
// auto-hide info and success-alerts after 3 seconds
|
// auto-hide info and success-alerts after 3 seconds
|
||||||
|
|||||||
@ -75,20 +75,11 @@
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
color: var(--color-lightwhite);
|
color: var(--color-lightwhite);
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
padding-left: 20px;
|
padding: 0 50px;
|
||||||
|
padding-right: 60px;
|
||||||
animation: slide-in-alert .2s ease-out forwards;
|
animation: slide-in-alert .2s ease-out forwards;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
transition: margin-bottom .2s ease-out;
|
transition: margin-bottom .2s ease-out;
|
||||||
|
|
||||||
&:hover {
|
|
||||||
|
|
||||||
.alert__content {
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes slide-in-alert {
|
@keyframes slide-in-alert {
|
||||||
@ -116,8 +107,7 @@
|
|||||||
@media (min-width: 425px) {
|
@media (min-width: 425px) {
|
||||||
|
|
||||||
.alert {
|
.alert {
|
||||||
max-width: 350px;
|
max-width: 400px;
|
||||||
padding-left: 30px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,22 +117,46 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.alert__content {
|
.alert__content {
|
||||||
padding: 8px 24px;
|
padding: 8px 0;
|
||||||
padding-left: 25px;
|
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
justify-content: flex-end;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.alert__icon {
|
||||||
|
text-align: right;
|
||||||
|
position: absolute;
|
||||||
|
left: 0px;
|
||||||
|
top: 0;
|
||||||
|
width: 50px;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 40;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '\f05a';
|
||||||
|
position: absolute;
|
||||||
|
font-family: "Font Awesome 5 Free";
|
||||||
|
font-size: 24px;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.alert__close {
|
.alert__close {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0px;
|
right: 0px;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 60px;
|
width: 60px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -184,13 +198,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.alert-success {
|
.alert-success {
|
||||||
background-image: linear-gradient(to right, var(--color-success) -40px, transparent 70px);
|
background-color: var(--color-success);
|
||||||
|
|
||||||
|
.alert__icon::before {
|
||||||
|
content: '\f058';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.alert-warning {
|
.alert-warning {
|
||||||
background-image: linear-gradient(to right, var(--color-warning) -40px, transparent 70px);
|
background-color: var(--color-warning);
|
||||||
|
|
||||||
|
.alert__icon::before {
|
||||||
|
content: '\f06a';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.alert-error {
|
.alert-error {
|
||||||
background-image: linear-gradient(to right, var(--color-error) -40px, transparent 70px);
|
background-color: var(--color-error);
|
||||||
|
|
||||||
|
.alert__icon::before {
|
||||||
|
content: '\f071';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user