mirror of
https://github.com/RhenCloud/Cloud-Index.git
synced 2025-12-06 15:26:10 +08:00
refactor: 模块化前端代码 - 将 main.js 和 main.css 拆分为专用模块
- 移除 main.js 并替换为8个 JS 模块 - 移除 main.css 并替换为7个 CSS 模块 - 更新 base.html 以加载模块化文件 - 通过 index.css 保持完全向后兼容 - 改进代码组织、可维护性和可复用性
This commit is contained in:
95
static/css/variables.css
Normal file
95
static/css/variables.css
Normal file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* CSS 变量和主题定义
|
||||
*/
|
||||
|
||||
:root {
|
||||
--bg-color: #f5f5f5;
|
||||
--container-bg: white;
|
||||
--text-color: #2c3e50;
|
||||
--border-color: #eee;
|
||||
--hover-bg: #f8f9fa;
|
||||
--secondary-text: #6c757d;
|
||||
--link-color: #007bff;
|
||||
--folder-color: #ffc107;
|
||||
--file-color: #6c757d;
|
||||
--shadow-color: rgba(0, 0, 0, 0.1);
|
||||
--icon-bg: #f0f0f0;
|
||||
--danger-color: #dc3545;
|
||||
--danger-hover-color: #a0202d;
|
||||
--warning-color: #ffc107;
|
||||
--warning-hover-color: #e0a800;
|
||||
--success-color: #28a745;
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
--bg-color: #1a1a1a;
|
||||
--container-bg: #2d2d2d;
|
||||
--text-color: #e1e1e1;
|
||||
--border-color: #404040;
|
||||
--hover-bg: #363636;
|
||||
--secondary-text: #a0a0a0;
|
||||
--link-color: #66b3ff;
|
||||
--folder-color: #ffd54f;
|
||||
--file-color: #b0b0b0;
|
||||
--shadow-color: rgba(0, 0, 0, 0.3);
|
||||
--icon-bg: #3a3a3a;
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础样式
|
||||
*/
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
padding: 20px;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
transition: background-color 0.3s ease, color 0.3s ease;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: var(--container-bg);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px var(--shadow-color);
|
||||
padding: 20px;
|
||||
width: calc(100% - 40px);
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: var(--text-color);
|
||||
margin-bottom: 30px;
|
||||
border-bottom: 2px solid var(--border-color);
|
||||
padding-bottom: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
h1 > div {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
Reference in New Issue
Block a user