toast-notification-js
Version:
A simple notification with better customization
89 lines (76 loc) • 1.51 kB
CSS
.toast-wrapper {
display: flex;
align-items: center;
padding: 0.5rem 1rem;
}
.toast-wrapper.left {
left: 0;
max-width: fit-content;
}
.toast-wrapper.center {
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
max-width: fit-content;
}
.toast-wrapper.right {
right: 0;
max-width: fit-content;
}
.toast {
display: flex;
align-items: center;
border-radius: 0.75rem;
padding: 0.5rem 1rem;
width: 100%;
gap: 0.5rem;
position: relative;
overflow: hidden;
}
.toast .toast-content-wrapper {
display: flex;
flex-direction: column;
max-width: 100%;
}
.toast .toast-content-wrapper .toast-title {
text-transform: capitalize;
font-size: 1.5rem;
font-weight: 600;
}
.toast .toast-content-wrapper .toast-message {
text-align: left;
font-size: 1rem;
}
.toast .toast-close-button,
.toast .toast-icon {
display: flex;
max-width: 32px;
max-height: 32px;
font-family: serif;
font-size: 1.5rem;
line-height: 2rem;
}
.toast .toast-icon {
overflow: hidden;
}
.toast .progress-bar {
width: 100%;
height: 4px;
position: absolute;
bottom: 0;
left: 0;
right: 0;
animation: linear shrink-width;
}
.toast:hover .progress-bar {
animation-play-state: paused;
}
@keyframes shrink-width {
from {
width: 100%;
}
to {
width: 0;
}
}