feat: implement toast notifications for image upload and blog post creation
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 22s

This commit is contained in:
2025-10-26 14:20:12 +08:00
parent 529af55002
commit 38ca76e2fb
6 changed files with 368 additions and 43 deletions

149
src/components/Toast.css Normal file
View File

@@ -0,0 +1,149 @@
.toast-container {
position: fixed;
top: 100px;
right: 20px;
z-index: 10000;
display: flex;
flex-direction: column;
gap: 12px;
pointer-events: none;
}
.toast {
display: flex;
align-items: center;
gap: 12px;
padding: 16px 20px;
border-radius: 12px;
background: var(--bg-card);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
border: 2px solid;
min-width: 300px;
max-width: 400px;
pointer-events: auto;
cursor: pointer;
animation: toast-enter 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: all 0.3s ease;
}
.toast:hover {
transform: translateX(-4px);
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}
.toast-exit {
animation: toast-exit 0.3s ease forwards;
}
@keyframes toast-enter {
from {
transform: translateX(400px);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes toast-exit {
from {
transform: translateX(0) scale(1);
opacity: 1;
}
to {
transform: translateX(400px) scale(0.8);
opacity: 0;
}
}
.toast-icon {
font-size: 24px;
flex-shrink: 0;
}
.toast-message {
flex: 1;
font-size: 15px;
font-weight: 500;
color: var(--text-primary);
line-height: 1.4;
}
.toast-close {
background: none;
border: none;
font-size: 24px;
color: var(--text-secondary);
cursor: pointer;
padding: 0;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
transition: all 0.2s ease;
flex-shrink: 0;
}
.toast-close:hover {
background: rgba(0, 0, 0, 0.1);
color: var(--text-primary);
}
.toast-success {
border-color: #4CAF50;
background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
}
.toast-error {
border-color: #F44336;
background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(244, 67, 54, 0.05));
}
.toast-warning {
border-color: #FF9800;
background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(255, 152, 0, 0.05));
}
.toast-info {
border-color: #2196F3;
background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
}
/* Mobile responsive */
@media (max-width: 768px) {
.toast-container {
top: 80px;
right: 10px;
left: 10px;
}
.toast {
min-width: unset;
max-width: unset;
}
@keyframes toast-enter {
from {
transform: translateY(-100px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@keyframes toast-exit {
from {
transform: translateY(0) scale(1);
opacity: 1;
}
to {
transform: translateY(-100px) scale(0.9);
opacity: 0;
}
}
}