react-compact-toast
Version:
A tiny, compact, and fully customizable toast notification library.
156 lines (132 loc) • 2.6 kB
CSS
@keyframes toastEnterFromBottom {
0% {
opacity: 0;
transform: translateY(100%) scale(0.96);
}
100% {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes toastExitToBottom {
0% {
opacity: 1;
transform: translateY(0) scale(1);
}
100% {
opacity: 0;
transform: translateY(100%) scale(0.96);
}
}
@keyframes toastEnterFromTop {
0% {
opacity: 0;
transform: translateY(-100%) scale(0.96);
}
100% {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes toastExitToTop {
0% {
opacity: 1;
transform: translateY(0) scale(1);
}
100% {
opacity: 0;
transform: translateY(-100%) scale(0.96);
}
}
.toast {
position: relative;
min-width: 280px;
min-height: 44px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
z-index: 9999;
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.15);
cursor: pointer;
pointer-events: auto;
touch-action: auto;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast-default-style {
background-color: rgb(40, 40, 40);
color: rgb(250, 250, 250);
border-radius: 16px;
padding: 16px 24px;
}
.toast-content {
display: flex;
justify-content: center;
align-items: center;
gap: 4px;
}
.toast-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: pre-line;
max-width: 320px;
font-size: 14px;
font-weight: 500;
line-height: 1.4;
}
.toast-highlight-text {
color: inherit;
font-weight: 600;
}
.toast-enter-top {
animation: toastEnterFromTop 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.toast-exit-top {
animation: toastExitToTop 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}
.toast-enter-bottom {
animation: toastEnterFromBottom 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.toast-exit-bottom {
animation: toastExitToBottom 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}
.toast-container {
display: flex;
flex-direction: column;
gap: 10px;
width: 100vw;
position: fixed;
z-index: 1000;
}
/* Position variants */
.toast-position-bottomCenter {
align-items: center;
bottom: 30px;
left: 0;
}
.toast-position-bottomLeft {
align-items: flex-start;
bottom: 30px;
left: 20px;
}
.toast-position-bottomRight {
align-items: flex-end;
bottom: 30px;
right: 20px;
}
.toast-position-topCenter {
align-items: center;
left: 0;
top: 30px;
}
.toast-position-topLeft {
align-items: flex-start;
left: 20px;
top: 30px;
}
.toast-position-topRight {
align-items: flex-end;
right: 20px;
top: 30px;
}
/*# sourceMappingURL=index.css.map*/