Skip to content

Commit 5210eb4

Browse files
committed
refactor: standardize CSS syntax and enhance transition durations
- Updated CSS import statements to use double quotes for consistency. - Standardized font-family declarations and button selectors. - Consolidated box-shadow properties for light and dark mode dialogs and cards. - Introduced global transition duration settings for Naive UI components and various transition classes to improve animation consistency. This refactor improves code readability and maintains a consistent styling approach across the application. Signed-off-by: Innei <tukon479@gmail.com>
1 parent 833dc5b commit 5210eb4

1 file changed

Lines changed: 61 additions & 17 deletions

File tree

src/index.css

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,300;1,300&display=swap');
1+
@import url("https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,300;1,300&display=swap");
22

33
body,
44
html {
55
margin: 0;
66
font-size: 14px !important;
77
padding: 0;
88

9-
--sans-font: 'Segoe UI', 'Helvetica Neue', sans-serif, -apple-system,
9+
--sans-font: "Segoe UI", "Helvetica Neue", sans-serif, -apple-system,
1010
system-ui;
1111

1212
font-family: var(--sans-font);
@@ -35,7 +35,7 @@ button {
3535
outline: unset;
3636
}
3737

38-
button:where(:not(.n-button):not([class*='n-'])) {
38+
button:where(:not(.n-button):not([class*="n-"])) {
3939
border: none;
4040
background: transparent;
4141
padding: 0;
@@ -151,18 +151,14 @@ button:where(:not(.n-button):not([class*='n-'])) {
151151
/* Light mode Dialog 阴影 */
152152
html:not(.dark) .n-dialog {
153153
@apply !rounded-xl;
154-
box-shadow:
155-
0 0 0 1px rgba(0, 0, 0, 0.06),
156-
0 8px 24px rgba(0, 0, 0, 0.08),
157-
0 16px 32px rgba(0, 0, 0, 0.06);
154+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08), 0
155+
16px 32px rgba(0, 0, 0, 0.06);
158156
}
159157

160158
/* Dark mode Dialog 阴影 */
161159
html.dark .n-dialog {
162160
@apply !rounded-xl;
163-
box-shadow:
164-
0 0 0 1px rgba(255, 255, 255, 0.08),
165-
0 8px 24px rgba(0, 0, 0, 0.5),
161+
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.5),
166162
0 16px 32px rgba(0, 0, 0, 0.4);
167163
}
168164

@@ -177,18 +173,14 @@ html.dark .n-dialog {
177173
/* Light mode Card 阴影 */
178174
html:not(.dark) .n-modal .n-card {
179175
@apply !rounded-xl;
180-
box-shadow:
181-
0 0 0 1px rgba(0, 0, 0, 0.06),
182-
0 8px 24px rgba(0, 0, 0, 0.08),
183-
0 16px 32px rgba(0, 0, 0, 0.06);
176+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08), 0
177+
16px 32px rgba(0, 0, 0, 0.06);
184178
}
185179

186180
/* Dark mode Card 阴影 */
187181
html.dark .n-modal .n-card {
188182
@apply !rounded-xl;
189-
box-shadow:
190-
0 0 0 1px rgba(255, 255, 255, 0.08),
191-
0 8px 24px rgba(0, 0, 0, 0.5),
183+
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.5),
192184
0 16px 32px rgba(0, 0, 0, 0.4);
193185
}
194186

@@ -199,3 +191,55 @@ html.dark .n-modal .n-card {
199191
.n-card-header__main {
200192
@apply !font-semibold;
201193
}
194+
195+
/* Naive UI 动画加速 - 全局 transition duration 覆盖 */
196+
[class*="n-"] {
197+
--n-duration: 0.2s !important;
198+
}
199+
200+
/* Transition 动画覆盖 */
201+
.fade-in-transition-enter-active,
202+
.fade-in-transition-leave-active,
203+
.fade-in-scale-up-transition-enter-active,
204+
.fade-in-scale-up-transition-leave-active,
205+
.fade-down-transition-enter-active,
206+
.fade-down-transition-leave-active,
207+
.icon-switch-transition-enter-active,
208+
.icon-switch-transition-leave-active,
209+
.fade-in-height-expand-transition-enter-active,
210+
.fade-in-height-expand-transition-leave-active,
211+
.fade-in-width-expand-transition-enter-active,
212+
.fade-in-width-expand-transition-leave-active {
213+
transition-duration: 0.2s !important;
214+
}
215+
216+
/* 组件内部 transition 覆盖 */
217+
.n-base-selection,
218+
.n-base-selection-label,
219+
.n-base-selection-input,
220+
.n-input,
221+
.n-input__input-el,
222+
.n-button,
223+
.n-checkbox,
224+
.n-radio,
225+
.n-switch,
226+
.n-slider,
227+
.n-select,
228+
.n-dropdown,
229+
.n-popover,
230+
.n-tooltip,
231+
.n-modal,
232+
.n-dialog,
233+
.n-drawer,
234+
.n-message,
235+
.n-notification,
236+
.n-card,
237+
.n-collapse,
238+
.n-collapse-item,
239+
.n-data-table,
240+
.n-pagination,
241+
.n-tabs,
242+
.n-menu,
243+
.n-tree {
244+
transition-duration: 0.2s !important;
245+
}

0 commit comments

Comments
 (0)