Refactor css checkpoint

This commit is contained in:
Will Miao
2025-02-17 19:21:40 +08:00
parent 36f7f33aa5
commit 2fc7235537
6 changed files with 505 additions and 527 deletions

View File

@@ -0,0 +1,97 @@
/* Update toast animation for trigger word copy */
.toast.toast-copy {
background: var(--lora-accent);
color: white;
border: none;
padding: 8px 16px;
font-size: 0.9em;
transform: translateX(-50%) translateY(20px);
}
.toast.toast-copy.show {
transform: translateX(-50%) translateY(0);
}
/* Toast Notifications */
.toast {
position: fixed;
top: 20px; /* 改为从顶部显示 */
right: 20px; /* 改为右对齐 */
left: auto; /* 移除左对齐 */
transform: translateX(120%); /* 初始位置在屏幕右侧外 */
min-width: 300px; /* 设置最小宽度 */
max-width: 400px; /* 设置最大宽度 */
background: var(--lora-surface);
color: var(--text-color);
padding: 12px 16px;
border-radius: var(--border-radius-sm);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
z-index: calc(var(--z-overlay) + 10); /* 让toast显示在最上层 */
opacity: 0;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
align-items: center;
gap: 12px;
}
.toast.show {
transform: translateX(0); /* 显示时滑入到正确位置 */
opacity: 1;
}
/* 添加图标容器 */
.toast::before {
content: '';
width: 20px;
height: 20px;
flex-shrink: 0;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
}
/* 不同类型的toast样式 */
.toast-success {
border-left: 4px solid oklch(65% 0.2 142);
}
.toast-success::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234caf50'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/%3E%3C/svg%3E");
}
.toast-error {
border-left: 4px solid oklch(65% 0.2 29);
}
.toast-error::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f44336'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z'/%3E%3C/svg%3E");
}
.toast-info {
border-left: 4px solid oklch(65% 0.2 256);
}
.toast-info::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232196f3'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
}
/* 多个toast堆叠显示 */
.toast + .toast {
margin-top: 10px;
}
/* 响应式调整 */
@media (max-width: 768px) {
.toast {
width: calc(100% - 40px); /* 左右各留20px间距 */
max-width: none;
right: 20px;
}
}
/* Ensure toasts are visible in both themes */
[data-theme="dark"] .toast {
background: var(--lora-surface);
color: var(--lora-text);
}