Skip to content

Commit bc74019

Browse files
author
reco_luan
committed
feat: add dark mode(part.3)
1. move SearchBox.vue to local 2. general adaptation work
1 parent 167e75a commit bc74019

30 files changed

+387
-156
lines changed

components/AlgoliaSearchBox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default {
7070
</script>
7171

7272
<style lang="stylus">
73-
@require '../styles/recoConfig.styl'
73+
@require '../styles/mode.styl'
7474
.algolia-search-wrapper
7575
& > span
7676
vertical-align middle

components/DropdownLink.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default {
8080
</script>
8181

8282
<style lang="stylus">
83-
@require '../styles/recoConfig.styl'
83+
@require '../styles/mode.styl'
8484
8585
.dropdown-wrapper
8686
cursor pointer

components/FriendLink.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export default {
113113
</script>
114114

115115
<style lang="stylus" scoped>
116-
@require '../styles/recoConfig.styl'
116+
@require '../styles/mode.styl'
117117
118118
.friend-link-wrapper
119119
position relative

components/Home.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default {
6767
</script>
6868

6969
<style lang="stylus">
70-
@require '../styles/recoConfig.styl'
70+
@require '../styles/mode.styl'
7171
@require '../styles/loadMixin.styl'
7272
7373
.home {

components/HomeBlog.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ export default {
141141
</script>
142142

143143
<style lang="stylus">
144-
@require '../styles/recoConfig.styl'
145-
@require '../styles/loadMixin.styl'
144+
// @require '../styles/mode.styl'
145+
// @require '../styles/loadMixin.styl'
146146
147147
.home-blog {
148148
padding: $navbarHeight 0 0;

components/Mode/ModeOptions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default {
6161
</script>
6262

6363
<style lang="stylus">
64-
@require '../../styles/recoConfig.styl'
64+
@require '../../styles/mode.styl'
6565
6666
.mode-options
6767
background-color var(--background-color)

components/Mode/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default {
4141
</script>
4242

4343
<style lang="stylus">
44-
@require '../../styles/recoConfig.styl'
44+
@require '../../styles/mode.styl'
4545
4646
.color-picker {
4747
position: relative;

components/Mode/modeOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const modeOptions = {
44
'--box-shadow': '0 1px 6px 0 rgba(0, 0, 0, 0.2)',
55
'--box-shadow-hover': '0 2px 16px 0 rgba(0, 0, 0, 0.2)',
66
'--text-color': '#2c3e50',
7-
'--border-color': '#cfd4db'
7+
'--border-color': '#eaecef'
88
},
99
dark: {
1010
'--background-color': '#25272a',

components/Mode/setMode.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import modeOptions from './modeOptions'
22

33
export function activateMode (mode) {
4-
console.log(mode)
54
const rootElement = document.querySelector(':root')
65
const options = modeOptions[mode]
76

@@ -10,29 +9,6 @@ export function activateMode (mode) {
109
}
1110
}
1211

13-
export function activateDarkMode () {
14-
const rootElement = document.querySelector(':root')
15-
const darkTheme = {
16-
'--background-color': '#25272a',
17-
'--box-shadow': '0 1px 6px 0 rgba(0, 0, 0, .9)',
18-
'--box-shadow-hover': '0 2px 26px 0 rgba(0, 0, 0, .9)'
19-
}
20-
for (const k in darkTheme) {
21-
rootElement.style.setProperty(k, darkTheme[k])
22-
}
23-
}
24-
25-
export function activateLightMode () {
26-
const rootElement = document.querySelector(':root')
27-
const lightTheme = {
28-
'--background-color': '#fff',
29-
'--box-shadow': '0 1px 6px 0 rgba(0, 0, 0, 0.2)',
30-
'--box-shadow-hover': '0 2px 16px 0 rgba(0, 0, 0, 0.2)'
31-
}
32-
for (const k in lightTheme) {
33-
rootElement.style.setProperty(k, lightTheme[k])
34-
}
35-
}
3612
/**
3713
* Sets a color scheme for the website.
3814
* If browser supports "prefers-color-scheme" it will respect the setting for light or dark mode

components/Navbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function css (el, property) {
8484
</script>
8585

8686
<style lang="stylus">
87-
@require '../styles/recoConfig.styl'
87+
@require '../styles/mode.styl'
8888
8989
$navbar-vertical-padding = 0.7rem
9090
$navbar-horizontal-padding = 1.5rem

0 commit comments

Comments
 (0)