-
Notifications
You must be signed in to change notification settings - Fork 13
/
style-override.js
55 lines (46 loc) · 1.13 KB
/
style-override.js
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
const generateOverride = (params = {}) => {
let result = ''
// 侧边栏宽度 - sidebarWidth
if (params.sidebarWidth && params.sidebarWidth !== '320px') {
result += `
.sidebar {
width: ${params.sidebarWidth};
}
.main-container {
margin-left: ${params.sidebarWidth};
}
`
}
// 菜单颜色 - menuColor
if (params.menuColor && params.menuColor !== '#dee2e6') {
result += `
.sidebar .top-container .site-nav {
color: ${params.menuColor};
}
`
}
// 封面图圆角 - featureBorderRadius
if (params.featureBorderRadius && params.featureBorderRadius !== '3px') {
result += `
.post-item .right .feature-container {
border-radius: ${params.featureBorderRadius};
}
`
}
// 内容区背景色 - contentBgColor
if (params.contentBgColor && params.contentBgColor !== '#f8f9fa') {
result += `
body {
background: ${params.contentBgColor};
}
`
}
if (params.customCss) {
result += `
${params.customCss}
`
}
console.log('result', result)
return result
}
module.exports = generateOverride