feedback.css
6.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/* ---------------------------------------------------------------------------
* 统一反馈层(message / notification)—— 站点化设计
*
* 背景:项目用 antd v6,其 message 结构为
* .ant-message-notice (卡片本体,自带 bg / radius / shadow)
* > .ant-message-notice-icon + .ant-message-notice-icon-<type> (图标)
* > .ant-message-notice-title (文案)
* notification 为 .ant-notification-notice (卡片) + ...-icon-<type> + ...-title + ...-description,
* 且类型类直接挂在卡片上(.ant-notification-notice-<type>)。
* v5 的 .ant-message-notice-content / .ant-message-custom-content / .ant-notification-notice-message
* 在 v6 均不存在,旧版选择器全部失效——本文件按 v6 真实 DOM 重写。
*
* 设计主张:把「语义类型」做成可一眼辨认的信号,而非一行小字——
* 1) 实心图标芯片(hero):语义色填满的圆角方块 + 白色字形;
* 2) 按类型染色的卡片底(notification 用类型类,message 用 :has() 同源染色);
* 3) 芯片入场轻微回弹 pop(仅作用于芯片自身,不动 antd 的定位 transform);
* 4) 位置统一顶部居中,卡形 / 影 / 描边沿用 .uj-card 同族 token,不另造色值。
*
* 选择器用 .ant-message / .ant-notification 前缀把特异性提到 (0,2,0),
* 既能压过 antd 自带样式,又能同时覆盖「App 上下文实例」与「静态实例」
* (全局兜底用的静态 message 也挂在 .ant-message 容器内)。
* ------------------------------------------------------------------------- */
/* ============================== MESSAGE ============================== */
/* 卡片本体:收口为品牌白卡(v6 里 .ant-message-notice 即卡片,自带 bg/radius/shadow)。 */
.ant-message .ant-message-notice {
padding: 12px 16px;
border: 1px solid var(--uj-border);
border-radius: var(--uj-radius-card);
background: var(--uj-surface);
box-shadow: var(--uj-shadow-card);
color: var(--uj-text-1);
}
/* 按类型染色:v6 类型类只挂在图标上,用 :has() 让整张卡片同源染色(wordless 识别)。 */
.ant-message .ant-message-notice:has(.ant-message-notice-icon-success) {
background: var(--uj-success-soft);
border-color: var(--uj-success-border);
}
.ant-message .ant-message-notice:has(.ant-message-notice-icon-error) {
background: var(--uj-error-soft);
border-color: var(--uj-error-border);
}
.ant-message .ant-message-notice:has(.ant-message-notice-icon-warning) {
background: var(--uj-warning-soft);
border-color: var(--uj-warning-border);
}
.ant-message .ant-message-notice:has(.ant-message-notice-icon-info),
.ant-message .ant-message-notice:has(.ant-message-notice-icon-loading) {
background: var(--uj-info-soft);
border-color: var(--uj-info-border);
}
.ant-message .ant-message-notice-title {
color: var(--uj-text-1);
font-weight: 600;
}
/* 图标保持语义色字形。不要再包成实心方块,否则图标字形在部分浏览器中不可见。 */
.ant-message .ant-message-notice-icon {
display: inline-flex;
align-items: center;
margin-inline-end: 8px;
font-size: 18px;
}
.ant-message .ant-message-notice-icon-success {
color: var(--uj-success);
}
.ant-message .ant-message-notice-icon-error {
color: var(--uj-error);
}
.ant-message .ant-message-notice-icon-warning {
color: var(--uj-warning);
}
.ant-message .ant-message-notice-icon-info,
.ant-message .ant-message-notice-icon-loading {
color: var(--uj-primary);
}
/* ============================ NOTIFICATION ============================ */
/* 卡片本体。 */
.ant-notification .ant-notification-notice {
padding: 14px 16px;
border: 1px solid var(--uj-border);
border-radius: var(--uj-radius-card);
background: var(--uj-surface);
box-shadow: var(--uj-shadow-card);
}
/* 按类型染色:v6 类型类直接挂在卡片上,比 :has() 更稳。 */
.ant-notification .ant-notification-notice-success {
background: var(--uj-success-soft);
border-color: var(--uj-success-border);
}
.ant-notification .ant-notification-notice-error {
background: var(--uj-error-soft);
border-color: var(--uj-error-border);
}
.ant-notification .ant-notification-notice-warning {
background: var(--uj-warning-soft);
border-color: var(--uj-warning-border);
}
.ant-notification .ant-notification-notice-info,
.ant-notification .ant-notification-notice-open {
background: var(--uj-info-soft);
border-color: var(--uj-info-border);
}
.ant-notification .ant-notification-notice-title {
color: var(--uj-text-1);
font-weight: 600;
}
.ant-notification .ant-notification-notice-description {
color: var(--uj-text-2);
}
/* 图标芯片(hero),比 message 略大以匹配通知卡的体量。 */
.ant-notification .ant-notification-notice-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
border-radius: var(--uj-radius-md);
font-size: 15px;
color: #fff;
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
animation: uj-feedback-chip-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ant-notification .ant-notification-notice-icon-success {
background: var(--uj-success);
}
.ant-notification .ant-notification-notice-icon-error {
background: var(--uj-error);
}
.ant-notification .ant-notification-notice-icon-warning {
background: var(--uj-warning);
}
.ant-notification .ant-notification-notice-icon-info,
.ant-notification .ant-notification-notice-icon-loading {
background: var(--uj-primary);
}
/* ============================ 动效 ============================ */
/* 芯片入场轻微回弹:只作用于芯片自身,不影响 antd 对 .ant-*-notice 的定位 transform。 */
@keyframes uj-feedback-chip-in {
0% {
transform: scale(0.4);
opacity: 0;
}
60% {
transform: scale(1.12);
opacity: 1;
}
100% {
transform: scale(1);
}
}
/* 尊重减少动效偏好:关闭芯片回弹,提示照常出现。 */
@media (prefers-reduced-motion: reduce) {
.ant-message .ant-message-notice-icon,
.ant-notification .ant-notification-notice-icon {
animation: none;
}
}