flexi-toast
Version:
Lightweight, customizable Angular toast notification component with title, message, icon types, auto-dismiss, manual close, animations, theme and positioning support.
344 lines (292 loc) • 7.85 kB
CSS
/* CSS değişkenlerini daha güçlü hale getirelim */
[data-bs-theme="light"] {
--flexi-toast-background-color: #ffffff ;
--flexi-toast-btn-border-color: #dee2e6 ;
--flexi-toast-cancel-btn-background-color: #6c757d ;
--flexi-toast-text-color: #212529 ;
--flexi-toast-success: #47D764 ;
--flexi-toast-warning: #FFC021 ;
--flexi-toast-error: #ff355b ;
--flexi-toast-info: #2F86EB ;
--flexi-toast-default: #ffffff ;
}
[data-bs-theme="dark"] {
--flexi-toast-background-color: #343a40 ;
--flexi-toast-btn-border-color: #495057 ;
--flexi-toast-cancel-btn-background-color: #6c757d ;
--flexi-toast-text-color: #ffffff ;
--flexi-toast-success: #47D764 ;
--flexi-toast-warning: #FFC021 ;
--flexi-toast-error: #ff355b ;
--flexi-toast-info: #2F86EB ;
--flexi-toast-default: #343a40 ;
}
.flexi-toast-wrapper {
width: 380px;
position: fixed;
z-index: 9999;
}
.flexi-taost-top-left {
top: 20px;
left: 20px;
}
.flexi-taost-top-right {
top: 20px;
right: 20px;
}
.flexi-taost-bottom-left {
bottom: 20px;
left: 20px;
}
.flexi-taost-bottom-right {
bottom: 20px;
right: 20px;
}
.flexi-taost-bottom-full {
padding-left: 10%;
padding-right: 10%;
width: 100%;
bottom: 20px;
}
.flexi-taost-top-full {
padding-left: 10%;
padding-right: 10%;
width: 100%;
top: 20px;
}
.flexi-toast {
padding: 20px;
background-color: var(--flexi-toast-background-color);
color: var(--flexi-toast-text-color);
border-radius: 7px;
display: flex;
justify-content: space-between;
gap: 10px;
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
opacity: 0;
transform: translateY(20px);
transition: opacity 0.5s, transform 0.5s;
}
.flexi-toast-success {
border-left: 8px solid var(--flexi-toast-success);
}
.flexi-toast-error {
border-left: 8px solid var(--flexi-toast-error);
}
.flexi-toast-info {
border-left: 8px solid var(--flexi-toast-info);
}
.flexi-toast-warning {
border-left: 8px solid var(--flexi-toast-warning);
}
.flexi-toast-container-1 svg {
width: 35px;
}
.flexi-toast-success svg {
fill: var(--flexi-toast-success);
}
.flexi-toast-error svg {
fill: var(--flexi-toast-error);
}
.flexi-toast-info svg {
fill: var(--flexi-toast-info);
}
.flexi-toast-warning svg {
fill: var(--flexi-toast-warning);
}
.flexi-toast:not(:last-child) {
margin-bottom: 10px;
}
.flexi-toast-container {
display: flex;
gap: 10px;
}
.flexi-toast-container-1,
.container-2 {
align-self: center;
}
.flexi-toast-container-2 {
display: flex;
flex-direction: column;
}
.flexi-toast-container-2 span:first-child {
color: var(--flexi-toast-text-color);
font-weight: 600;
font-size: 16px;
}
.flexi-toast-container-2 span:last-child {
font-size: 12px;
font-weight: 400;
color: var(--flexi-toast-text-color);
}
.flexi-toast-close-btn {
align-self: flex-start;
background-color: transparent;
font-size: 25px;
color: #656565;
line-height: 0;
cursor: pointer;
}
.flexi-toast-fade-in {
opacity: 1;
transform: translateY(0);
}
.flexi-toast-fade-out {
opacity: 0;
transform: translateY(20px);
}
.flexi-toast-progress-bar {
position: absolute;
bottom: 0;
left: 0;
height: 100%;
width: 0;
opacity: 0.1;
}
.flex-toast-progress-bar-success {
background: var(--flexi-toast-success);
}
.flex-toast-progress-bar-error {
background: var(--flexi-toast-error);
}
.flex-toast-progress-bar-info {
background: var(--flexi-toast-info);
}
.flex-toast-progress-bar-warning {
background: var(--flexi-toast-warning);
}
/* ----------------------- Toast Son ------------------------------------------------------ */
/* ------------------- Swal Başlangıç ----------------------------------------------------- */
.flexi-swal-container{
display: flex;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
justify-content: center;
align-items: center;
z-index: 9999;
}
.flexi-swal-content{
background-color: var(--flexi-toast-background-color);
color: var(--flexi-toast-text-color);
min-width: 300px;
border-radius: 8px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
animation: fadeIn 0.3s ease-in-out;
}
.flexi-swal-title-container, .flexi-swal-question-container, .flexi-swal-button-container{
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid var(--flexi-toast-btn-border-color);
}
.flexi-swal-title-container{
padding: 10px 15px;
font-size: 1rem;
background-color: var(--flexi-toast-background-color);
color: var(--flexi-toast-text-color);
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}
.flexi-swal-question-container{
padding: 15px 15px;
font-size: 0.9rem;
color: var(--flexi-toast-text-color);
background-color: var(--flexi-toast-background-color);
}
.flexi-swal-button-container{
gap: 5px;
background-color: var(--flexi-toast-background-color);
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
border-bottom: none;
}
.flexi-swal-button {
width: 100%;
padding: 8px 16px;
border: 1px solid var(--flexi-toast-btn-border-color);
background-color: var(--flexi-toast-background-color);
color: var(--flexi-toast-text-color);
border-radius: 4px;
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease-in-out;
}
.flexi-swal-button:hover {
opacity: 0.8;
transform: translateY(-1px);
}
.flexi-swal-button-primary {
background-color: rgb(16, 138, 229);
border-color: rgb(16, 138, 229);
color: white;
}
.flexi-swal-button-primary:hover {
background-color: rgb(10, 110, 190);
}
.flexi-swal-close-button{
border: 0px;
background-color: transparent;
padding: 1px 10px;
color: var(--flexi-toast-text-color);
border-radius: 4px;
transition: background-color 0.2s ease-in-out;
}
.flexi-swal-close-button:hover{
background-color: var(--flexi-toast-btn-border-color);
}
.flexi-swal-close-btn {
position: absolute;
top: 10px;
right: 15px;
background-color: transparent;
border: none;
font-size: 20px;
color: var(--flexi-toast-text-color);
cursor: pointer;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: background-color 0.2s ease-in-out;
}
.flexi-swal-close-btn:hover {
background-color: var(--flexi-toast-btn-border-color);
}
/* Dark theme için özel renkler */
[data-bs-theme="dark"] .flexi-swal-container {
background: rgba(0, 0, 0, 0.7);
}
[data-bs-theme="dark"] .flexi-swal-content {
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
/* Fade in animation */
@keyframes fadeIn {
from {
opacity: 0;
transform: scale(0.9);
}
to {
opacity: 1;
transform: scale(1);
}
}
.fade-out {
animation: fadeOut 0.2s ease-in-out forwards;
}
@keyframes fadeOut {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(0.9);
}
}