@mathwiz/ui-components 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/App.css ADDED
@@ -0,0 +1,570 @@
1
+ /* 全局变量与重置 */
2
+ :root {
3
+ --header-height: 64px;
4
+ --sidebar-width: 280px;
5
+ --sidebar-width-collapsed: 60px;
6
+ --sidebar-bg: #f8f9fa;
7
+ --main-content-bg: #ffffff;
8
+ --border-color: #dee2e6;
9
+ --text-primary: #212529;
10
+ --text-secondary: #6c757d;
11
+ --accent-color: #4361ee;
12
+ --accent-light: #e6f2ff;
13
+ --hover-bg: #e9ecef;
14
+ --active-bg: #dbeafe;
15
+ --transition-speed: 0.3s;
16
+ --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
17
+ --border-radius: 8px;
18
+ --success-color: #10b981;
19
+ --warning-color: #f59e0b;
20
+ }
21
+
22
+ * {
23
+ box-sizing: border-box;
24
+ margin: 0;
25
+ padding: 0;
26
+ }
27
+
28
+ body {
29
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
30
+ background-color: #f0f2f5;
31
+ color: var(--text-primary);
32
+ line-height: 1.6;
33
+ }
34
+
35
+ /* 页面整体布局 */
36
+ .app-layout {
37
+ display: flex;
38
+ flex-direction: column;
39
+ height: 100vh;
40
+ }
41
+
42
+ .page-container {
43
+ display: flex;
44
+ flex-grow: 1;
45
+ height: calc(100vh - var(--header-height));
46
+ }
47
+
48
+ /* Header 组件样式 */
49
+ .site-header {
50
+ height: var(--header-height);
51
+ background-image: linear-gradient(to right, #8b5cf6, #ec4899, #ef4444);
52
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
53
+ position: sticky;
54
+ top: 0;
55
+ z-index: 1000;
56
+ color: white;
57
+ }
58
+
59
+ .header-content {
60
+ height: 100%;
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: space-between;
64
+ padding: 0 1.5rem;
65
+ max-width: 1280px;
66
+ margin: 0 auto;
67
+ }
68
+
69
+ .header-section {
70
+ flex: 1;
71
+ }
72
+
73
+ .header-section.left {
74
+ display: flex;
75
+ justify-content: flex-start;
76
+ }
77
+
78
+ .header-section.center {
79
+ text-align: center;
80
+ }
81
+
82
+ .header-section.right {
83
+ display: flex;
84
+ justify-content: flex-end;
85
+ }
86
+
87
+ .logo a {
88
+ color: white;
89
+ text-decoration: none;
90
+ font-size: 1.5rem;
91
+ font-weight: bold;
92
+ }
93
+
94
+ /* Explore Dropdown 组件样式 */
95
+ .explore-dropdown {
96
+ position: relative;
97
+ }
98
+
99
+ .explore-button {
100
+ background: none;
101
+ border: none;
102
+ color: #e5e7eb;
103
+ cursor: pointer;
104
+ padding: 0.5rem 0.75rem;
105
+ border-radius: 6px;
106
+ font-size: 0.875rem;
107
+ font-weight: 500;
108
+ display: flex;
109
+ align-items: center;
110
+ transition: background-color 0.2s;
111
+ }
112
+
113
+ .explore-button:hover {
114
+ background-color: rgba(255, 255, 255, 0.1);
115
+ color: white;
116
+ }
117
+
118
+ .explore-button .icon {
119
+ font-size: 1.25rem;
120
+ margin-right: 0.25rem;
121
+ }
122
+
123
+ .explore-panel {
124
+ display: none;
125
+ position: absolute;
126
+ top: 100%;
127
+ left: 0;
128
+ margin-top: 0.5rem;
129
+ width: 256px;
130
+ background-color: white;
131
+ border-radius: var(--border-radius);
132
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
133
+ border: 1px solid var(--border-color);
134
+ padding: 0.5rem 0;
135
+ z-index: 1010;
136
+ }
137
+
138
+ .explore-panel.is-open {
139
+ display: block;
140
+ }
141
+
142
+ .explore-panel .scroll-container {
143
+ max-height: 384px;
144
+ overflow-y: auto;
145
+ }
146
+
147
+ .explore-panel button {
148
+ width: 100%;
149
+ display: flex;
150
+ align-items: center;
151
+ padding: 0.5rem 1rem;
152
+ font-size: 0.875rem;
153
+ color: var(--text-primary);
154
+ background: none;
155
+ border: none;
156
+ cursor: pointer;
157
+ transition: background-color 0.15s, color 0.15s;
158
+ text-align: left;
159
+ }
160
+
161
+ .explore-panel button:hover {
162
+ background-color: var(--hover-bg);
163
+ color: #8b5cf6;
164
+ }
165
+
166
+ .explore-panel .status {
167
+ margin-left: auto;
168
+ font-size: 0.75rem;
169
+ font-weight: 500;
170
+ }
171
+
172
+ .status-new {
173
+ background-color: var(--success-color);
174
+ color: white;
175
+ padding: 2px 8px;
176
+ border-radius: 9999px;
177
+ }
178
+
179
+ .status-progress {
180
+ color: #8b5cf6;
181
+ }
182
+
183
+ .explore-footer {
184
+ border-top: 1px solid var(--border-color);
185
+ margin-top: 0.5rem;
186
+ padding-top: 0.5rem;
187
+ }
188
+
189
+ /* User Widget 组件样式 */
190
+ .user-widget {
191
+ display: flex;
192
+ align-items: center;
193
+ gap: 0.75rem;
194
+ }
195
+
196
+ .user-avatar img {
197
+ width: 40px;
198
+ height: 40px;
199
+ border-radius: 50%;
200
+ border: 2px solid white;
201
+ }
202
+
203
+ .user-info .name {
204
+ font-weight: 600;
205
+ font-size: 0.9rem;
206
+ color: white !important;
207
+ }
208
+
209
+ .user-info .level {
210
+ font-size: 0.75rem;
211
+ color: white !important;
212
+ opacity: 0.9;
213
+ }
214
+
215
+ .user-badges {
216
+ display: flex;
217
+ gap: 0.25rem;
218
+ }
219
+
220
+ /* 侧边栏及主内容区样式 */
221
+ .sidebar-container {
222
+ height: 100%;
223
+ flex-shrink: 0;
224
+ width: var(--sidebar-width);
225
+ min-width: 220px;
226
+ background-color: var(--sidebar-bg);
227
+ border-right: 1px solid var(--border-color);
228
+ position: relative;
229
+ transition: width var(--transition-speed) ease, min-width var(--transition-speed) ease;
230
+ display: flex;
231
+ flex-direction: column;
232
+ overflow: hidden;
233
+ }
234
+
235
+ .main-view {
236
+ height: 100%;
237
+ flex-grow: 1;
238
+ overflow-y: auto;
239
+ padding: 2rem;
240
+ background-color: var(--main-content-bg);
241
+ /* 修复:防止文字内容影响宽度 */
242
+ width: calc(100vw - var(--sidebar-width) - 2px);
243
+ /* 减去边框宽度 */
244
+ max-width: calc(100vw - var(--sidebar-width) - 2px);
245
+ min-height: 100%;
246
+ box-sizing: border-box;
247
+ }
248
+
249
+ .sidebar-toggle {
250
+ position: absolute;
251
+ top: 15px;
252
+ right: -15px;
253
+ width: 30px;
254
+ height: 30px;
255
+ background-color: white;
256
+ border: 1px solid var(--border-color);
257
+ border-radius: 50%;
258
+ cursor: pointer;
259
+ display: flex;
260
+ justify-content: center;
261
+ align-items: center;
262
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
263
+ z-index: 10;
264
+ }
265
+
266
+ .sidebar-toggle:hover {
267
+ background-color: var(--accent-color);
268
+ color: white;
269
+ }
270
+
271
+ .grade-header {
272
+ padding: 1rem;
273
+ font-size: 1.25rem;
274
+ font-weight: 600;
275
+ border-bottom: 1px solid var(--border-color);
276
+ color: var(--text-primary);
277
+ white-space: nowrap;
278
+ overflow: hidden;
279
+ transition: opacity var(--transition-speed) ease;
280
+ }
281
+
282
+ .navigation-tree {
283
+ list-style: none;
284
+ padding: 0.5rem;
285
+ margin: 0;
286
+ flex-grow: 1;
287
+ overflow-y: auto;
288
+ }
289
+
290
+ .unit-item a {
291
+ display: flex;
292
+ align-items: center;
293
+ width: 100%;
294
+ padding: 0.8rem 1rem;
295
+ font-size: 1rem;
296
+ text-decoration: none;
297
+ color: var(--text-secondary);
298
+ border-radius: 6px;
299
+ transition: background-color 0.2s ease;
300
+ white-space: nowrap;
301
+ overflow: hidden;
302
+ }
303
+
304
+ .unit-item__icon {
305
+ margin-right: 1rem;
306
+ font-size: 1.2rem;
307
+ width: 24px;
308
+ text-align: center;
309
+ }
310
+
311
+ .unit-item__title {
312
+ transition: opacity var(--transition-speed) ease;
313
+ }
314
+
315
+ .unit-item a:hover {
316
+ background-color: var(--hover-bg);
317
+ }
318
+
319
+ .unit-item.active a {
320
+ background-color: var(--active-bg);
321
+ color: var(--accent-color);
322
+ font-weight: 500;
323
+ }
324
+
325
+ .sidebar-container.collapsed {
326
+ width: var(--sidebar-width-collapsed);
327
+ min-width: var(--sidebar-width-collapsed);
328
+ }
329
+
330
+ .sidebar-container.collapsed .grade-header,
331
+ .sidebar-container.collapsed .unit-item__title {
332
+ opacity: 0;
333
+ }
334
+
335
+ .sidebar-container.collapsed .unit-item__icon {
336
+ margin-right: 0;
337
+ }
338
+
339
+ .sidebar-container.collapsed .sidebar-toggle svg {
340
+ transform: rotate(180deg);
341
+ }
342
+
343
+ /* 全局文字样式修复 - 防止文字撑开容器 */
344
+ .main-view h1,
345
+ .main-view h2,
346
+ .main-view h3,
347
+ .main-view h4,
348
+ .main-view h5,
349
+ .main-view h6,
350
+ .main-view p,
351
+ .main-view div,
352
+ .main-view span {
353
+ max-width: 100%;
354
+ word-wrap: break-word;
355
+ overflow-wrap: break-word;
356
+ word-break: break-word;
357
+ white-space: normal;
358
+ box-sizing: border-box;
359
+ }
360
+
361
+ /* 主内容区样式 */
362
+ .unit-header {
363
+ background-color: #fff;
364
+ padding: 1.5rem 2rem;
365
+ border-radius: var(--border-radius);
366
+ box-shadow: var(--box-shadow);
367
+ margin-bottom: 2rem;
368
+ border-left: 5px solid var(--accent-color);
369
+ }
370
+
371
+ .unit-header h1 {
372
+ margin-top: 0;
373
+ font-size: 2rem;
374
+ color: var(--accent-color);
375
+ }
376
+
377
+ .unit-header p {
378
+ font-size: 1rem;
379
+ color: var(--text-secondary);
380
+ line-height: 1.6;
381
+ }
382
+
383
+ /* 课程导航树样式 */
384
+ .lesson-navigation-tree {
385
+ background-color: #fff;
386
+ border-radius: var(--border-radius);
387
+ box-shadow: var(--box-shadow);
388
+ overflow: hidden;
389
+ margin-bottom: 2rem;
390
+ }
391
+
392
+ .lesson-item {
393
+ border-bottom: 1px solid var(--border-color);
394
+ }
395
+
396
+ .lesson-item:last-child {
397
+ border-bottom: none;
398
+ }
399
+
400
+ .lesson-item-header {
401
+ padding: 1rem 1.5rem;
402
+ display: flex;
403
+ justify-content: space-between;
404
+ align-items: center;
405
+ cursor: pointer;
406
+ background-color: #fff;
407
+ transition: background-color 0.2s ease;
408
+ }
409
+
410
+ .lesson-item-header:hover {
411
+ background-color: var(--hover-bg);
412
+ }
413
+
414
+ .lesson-item-header h2 {
415
+ margin: 0;
416
+ font-size: 1.25rem;
417
+ }
418
+
419
+ .lesson-item-header .duration {
420
+ font-size: 0.9rem;
421
+ color: var(--text-secondary);
422
+ background-color: var(--sidebar-bg);
423
+ padding: 0.25rem 0.5rem;
424
+ border-radius: 1rem;
425
+ }
426
+
427
+ .lesson-item.active .lesson-item-header {
428
+ background-color: var(--active-bg);
429
+ color: var(--accent-color);
430
+ font-weight: 500;
431
+ }
432
+
433
+ .knowledge-list {
434
+ padding: 0;
435
+ background-color: var(--sidebar-bg);
436
+ display: none;
437
+ }
438
+
439
+ .lesson-item.active .knowledge-list {
440
+ display: block;
441
+ }
442
+
443
+ .knowledge-item {
444
+ padding: 1rem 1.5rem 1rem 3rem;
445
+ display: flex;
446
+ align-items: center;
447
+ justify-content: space-between;
448
+ position: relative;
449
+ border-bottom: 1px solid var(--border-color);
450
+ transition: background-color 0.2s;
451
+ }
452
+
453
+ .knowledge-item:last-child {
454
+ border-bottom: none;
455
+ }
456
+
457
+ .knowledge-item:hover {
458
+ background-color: var(--hover-bg);
459
+ }
460
+
461
+ .knowledge-item::before {
462
+ content: '';
463
+ position: absolute;
464
+ top: 0;
465
+ left: 0;
466
+ height: 100%;
467
+ width: 4px;
468
+ background-color: var(--accent-color);
469
+ opacity: 0;
470
+ transition: opacity 0.2s;
471
+ }
472
+
473
+ .knowledge-item:hover::before {
474
+ opacity: 1;
475
+ }
476
+
477
+ .knowledge-item-content {
478
+ flex-grow: 1;
479
+ }
480
+
481
+ .knowledge-item-content h3 {
482
+ margin: 0 0 0.25rem 0;
483
+ font-size: 1.1rem;
484
+ }
485
+
486
+ .knowledge-item-content p {
487
+ margin: 0;
488
+ font-size: 0.9rem;
489
+ color: var(--text-secondary);
490
+ /* 修复:防止长文本撑开容器 */
491
+ max-width: 100%;
492
+ word-wrap: break-word;
493
+ overflow-wrap: break-word;
494
+ word-break: break-word;
495
+ line-height: 1.5;
496
+ }
497
+
498
+ .knowledge-item-actions {
499
+ display: flex;
500
+ align-items: center;
501
+ flex-shrink: 0;
502
+ margin-left: 1rem;
503
+ }
504
+
505
+ .knowledge-item-actions .status {
506
+ font-size: 0.9rem;
507
+ font-weight: 500;
508
+ margin-right: 1.5rem;
509
+ width: 60px;
510
+ text-align: right;
511
+ }
512
+
513
+ .knowledge-item-actions .btn {
514
+ padding: 0.5rem 1.25rem;
515
+ border: 1px solid var(--accent-color);
516
+ border-radius: 2rem;
517
+ font-size: 0.9rem;
518
+ font-weight: 600;
519
+ cursor: pointer;
520
+ transition: all 0.2s ease;
521
+ text-decoration: none;
522
+ display: inline-block;
523
+ }
524
+
525
+ .btn-primary {
526
+ background-color: var(--accent-color);
527
+ color: #fff;
528
+ }
529
+
530
+ .btn-primary:hover {
531
+ background-color: #3651b5;
532
+ border-color: #3651b5;
533
+ }
534
+
535
+ .btn-secondary {
536
+ background-color: transparent;
537
+ color: var(--accent-color);
538
+ }
539
+
540
+ .btn-secondary:hover {
541
+ background-color: var(--accent-light);
542
+ }
543
+
544
+ /* 响应式设计 */
545
+ @media (max-width: 768px) {
546
+ .sidebar-container {
547
+ width: var(--sidebar-width-collapsed);
548
+ min-width: var(--sidebar-width-collapsed);
549
+ }
550
+
551
+ .sidebar-container:not(.manual-expand) .grade-header,
552
+ .sidebar-container:not(.manual-expand) .unit-item__title {
553
+ opacity: 0;
554
+ }
555
+
556
+ .main-view {
557
+ padding: 1rem;
558
+ /* 移动端修复:调整宽度计算 */
559
+ width: calc(100vw - var(--sidebar-width-collapsed) - 2px);
560
+ max-width: calc(100vw - var(--sidebar-width-collapsed) - 2px);
561
+ }
562
+
563
+ .unit-header {
564
+ padding: 1rem;
565
+ }
566
+
567
+ .unit-header h1 {
568
+ font-size: 1.5rem;
569
+ }
570
+ }