1
1
<template >
2
2
<f7-block >
3
3
<f7-block-title class =" padding-left" >Theme</f7-block-title >
4
- <f7-segmented >
5
- <f7-button round color =" blue" raised :fill =" theme === 'auto'" @click =" switchTheme('auto')" >Auto</f7-button >
6
- <f7-button round color =" blue" raised :fill =" theme === 'md'" @click =" switchTheme('md')" >MD</f7-button >
7
- <f7-button round color =" blue" raised :fill =" theme === 'ios'" @click =" switchTheme('ios')" >iOS</f7-button >
8
- <f7-button round color =" blue" raised :fill =" theme === 'aurora'" @click =" switchTheme('aurora')" >Aurora</f7-button >
9
- </f7-segmented >
4
+ <f7-row >
5
+ <f7-col width =" 25" class =" theme-picker auto" @click =" switchTheme('auto')" >
6
+ <span class =" text-color-gray" >Auto</span >
7
+ <f7-checkbox checked disabled v-if =" theme === 'auto'" />
8
+ </f7-col >
9
+ <f7-col width =" 25" class =" theme-picker" @click =" switchTheme('md')" >
10
+ <span ><f7-icon f7 =" logo_android" size =" 20" color =" gray" /></span >
11
+ <f7-checkbox checked disabled v-if =" theme === 'md'" />
12
+ </f7-col >
13
+ <f7-col width =" 25" class =" theme-picker" @click =" switchTheme('ios')" >
14
+ <span ><f7-icon f7 =" logo_ios" size =" 25" color =" gray" /></span >
15
+ <f7-checkbox checked disabled v-if =" theme === 'ios'" />
16
+ </f7-col >
17
+ <f7-col width =" 25" class =" theme-picker" @click =" switchTheme('aurora')" >
18
+ <span ><f7-icon f7 =" desktopcomputer" size =" 20" color =" gray" /></span >
19
+ <f7-checkbox checked disabled v-if =" theme === 'aurora'" />
20
+ </f7-col >
21
+ </f7-row >
10
22
<f7-block-title >Dark mode</f7-block-title >
11
- <f7-segmented >
12
- <f7-button round color =" blue" raised :fill =" darkMode === 'auto'" @click =" setThemeDark('auto')" >Auto</f7-button >
13
- <f7-button round color =" blue" raised :fill =" darkMode === 'light'" @click =" setThemeDark('light')" >Light</f7-button >
14
- <f7-button round color =" blue" raised :fill =" darkMode === 'dark'" @click =" setThemeDark('dark')" >Dark</f7-button >
15
- </f7-segmented >
23
+ <f7-row >
24
+ <f7-col width =" 33" class =" theme-picker auto" @click =" setThemeDark('auto')" >
25
+ <span class =" text-color-gray" >Auto</span >
26
+ <f7-checkbox checked disabled v-if =" darkMode === 'auto'" />
27
+ </f7-col >
28
+ <f7-col width =" 33" class =" bg-color-white theme-picker" @click =" setThemeDark('light')" >
29
+ <span class =" text-color-gray" >Light</span >
30
+ <f7-checkbox checked disabled v-if =" darkMode === 'light'" />
31
+ </f7-col >
32
+ <f7-col width =" 33" class =" bg-color-black theme-picker" @click =" setThemeDark('dark')" >
33
+ <span class =" text-color-gray" >Dark</span >
34
+ <f7-checkbox checked disabled v-if =" darkMode === 'dark'" />
35
+ </f7-col >
36
+ </f7-row >
16
37
<f7-block-title >Navigation bars style</f7-block-title >
17
38
<f7-row >
18
- <f7-col width =" 50" class =" demo -bars-picker demo -bars-picker-fill" @click =" setBarsStyle('filled')" >
39
+ <f7-col width =" 50" class =" nav -bars-picker nav -bars-picker-fill" @click =" setBarsStyle('filled')" >
19
40
<div class =" demo-navbar" ></div >
20
41
<f7-checkbox checked disabled v-if =" barsStyle === 'filled'" />
21
42
</f7-col >
22
- <f7-col width =" 50" class =" demo -bars-picker demo -bars-picker-empty" @click =" setBarsStyle('light')" >
43
+ <f7-col width =" 50" class =" nav -bars-picker nav -bars-picker-empty" @click =" setBarsStyle('light')" >
23
44
<div class =" demo-navbar" ></div >
24
45
<f7-checkbox checked disabled v-if =" barsStyle === 'light'" />
25
46
</f7-col >
33
54
<span >Simple navigation bar on home page</span >
34
55
<f7-toggle :checked =" homePageNavbarStyle === 'simple'" @toggle:change =" setHomePageNavbarStyle" ></f7-toggle >
35
56
</f7-list-item >
57
+ <f7-list-item >
58
+ <span >Standard home page background color</span >
59
+ <f7-toggle :checked =" homePageBackground === 'standard'" @toggle:change =" setHomePageBackground" ></f7-toggle >
60
+ </f7-list-item >
36
61
<f7-list-item >
37
62
<span >Disable card expansion animations</span >
38
63
<f7-toggle :checked =" expandableCardsAnimation === 'disabled'" @toggle:change =" setExpandableCardAnimation" ></f7-toggle >
@@ -51,13 +76,16 @@ export default {
51
76
methods: {
52
77
switchTheme (theme ) {
53
78
localStorage .setItem (' openhab.ui:theme' , theme)
79
+ localStorage .removeItem (' openhab.ui:theme.bars' ) // reset the bars to their default when switching themes
54
80
location .reload ()
55
- // document.location = document.location.origin + document.location.pathname + '?theme=' + theme
56
81
},
57
82
setThemeDark (value ) {
58
- value === ' auto'
59
- ? localStorage .removeItem (' openhab.ui:theme.dark' ) : localStorage .setItem (' openhab.ui:theme.dark' , value)
60
- localStorage .setItem (' openhab.ui:theme.bars' , ' light' ) // dark theme with filled bars is ugly, switch to light bars too
83
+ if (value === ' auto' ) {
84
+ localStorage .removeItem (' openhab.ui:theme.dark' )
85
+ } else {
86
+ localStorage .setItem (' openhab.ui:theme.dark' , value)
87
+ }
88
+ localStorage .removeItem (' openhab.ui:theme.bars' ) // reset the bars to their default when switching dark mode
61
89
location .reload ()
62
90
},
63
91
setBarsStyle (value ) {
@@ -68,12 +96,16 @@ export default {
68
96
localStorage .setItem (' openhab.ui:theme.home.navbar' , (value) ? ' simple' : ' default' )
69
97
location .reload ()
70
98
},
99
+ setHomePageBackground (value ) {
100
+ localStorage .setItem (' openhab.ui:theme.home.background' , (value) ? ' standard' : ' default' )
101
+ location .reload ()
102
+ },
71
103
setExpandableCardAnimation (value ) {
72
104
localStorage .setItem (' openhab.ui:theme.home.cardanimation' , (value) ? ' disabled' : ' default' )
73
105
location .reload ()
74
106
},
75
107
setPageTransitionAnimation (value ) {
76
- localStorage .setItem (' openhab.ui:theme.home. pagetransition' , (value) ? ' disabled' : ' default' )
108
+ localStorage .setItem (' openhab.ui:theme.pagetransition' , (value) ? ' disabled' : ' default' )
77
109
location .reload ()
78
110
}
79
111
},
@@ -85,80 +117,105 @@ export default {
85
117
return localStorage .getItem (' openhab.ui:theme.dark' ) || ' auto'
86
118
},
87
119
barsStyle () {
88
- return localStorage .getItem (' openhab.ui:theme.bars' ) || ((! this .$theme .ios ) ? ' filled ' : ' light ' )
120
+ return localStorage .getItem (' openhab.ui:theme.bars' ) || ((this .$theme .ios || this . $f7 . darkTheme || this . darkMode === ' dark ' ) ? ' light ' : ' filled ' )
89
121
},
90
122
homePageNavbarStyle () {
91
123
return localStorage .getItem (' openhab.ui:theme.home.navbar' ) || ' default'
92
124
},
125
+ homePageBackground () {
126
+ return localStorage .getItem (' openhab.ui:theme.home.background' ) || ' default'
127
+ },
93
128
expandableCardsAnimation () {
94
129
return localStorage .getItem (' openhab.ui:theme.home.cardanimation' ) || ' default'
95
130
},
96
131
pageTransitionAnimation () {
97
- return localStorage .getItem (' openhab.ui:theme.home. pagetransition' ) || ' default'
132
+ return localStorage .getItem (' openhab.ui:theme.pagetransition' ) || ' default'
98
133
}
99
134
}
100
135
}
101
136
</script >
102
- <style >
103
- .demo-bars-picker {
104
- height : 200px ;
105
- border-radius : 10px ;
106
- box-shadow : 0px 5px 20px rgba (0 ,0 ,0 ,0.1 );
107
- cursor : pointer ;
108
- position : relative ;
109
- overflow : hidden ;
110
- background : var (--f7-page-bg-color );
111
- border : 1px solid rgba (255 ,255 ,255 ,0.2 );
112
- }
113
- .demo-bars-picker .checkbox {
114
- position : absolute ;
115
- left : 10px ;
116
- bottom : 10px ;
117
- }
137
+ <style lang="stylus">
138
+ .theme-picker
139
+ cursor pointer
140
+ height 100px
141
+ padding 40px 20px
142
+ border-radius 10px
143
+ box-shadow 0px 5px 20px rgba (0 ,0 ,0 ,0.1 )
144
+ border 1px solid rgba (255 ,255 ,255 ,0.2 )
145
+ box-sizing border-box
146
+ position relative
147
+ display flex
148
+ align-content center
149
+ font-size 16px
150
+ span
151
+ width 100%
152
+ text-align center
153
+ i .f7-icons
154
+ width 100%
155
+ text-align center
156
+ .checkbox
157
+ position absolute
158
+ left 10px
159
+ bottom 10px
160
+
161
+ .nav-bars-picker
162
+ height 200px
163
+ border-radius 10px
164
+ box-shadow 0px 5px 20px rgba (0 ,0 ,0 ,0.1 )
165
+ cursor pointer
166
+ position relative
167
+ overflow hidden
168
+ background var (-- f7-page-bg-color )
169
+ border 1px solid rgba (255 ,255 ,255 ,0.2 )
170
+
171
+ .nav-bars-picker .checkbox
172
+ position absolute
173
+ left 10px
174
+ bottom 10px
175
+
176
+ .nav-bars-picker .demo-navbar
177
+ position absolute
178
+ left 0
179
+ width 100%
180
+ height 30px
181
+ top 0
182
+ border-bottom 1px solid transparent
183
+
184
+ .nav-bars-picker .demo-navbar :before
185
+ content ''
186
+ position absolute
187
+ left 10px
188
+ width 20px
189
+ height 10px
190
+ top 50%
191
+ margin-top - 5px
192
+
193
+ .nav-bars-picker .demo-navbar :after
194
+ content ''
195
+ position absolute
196
+ right 10px
197
+ width 20px
198
+ height 10px
199
+ top 50%
200
+ margin-top - 5px
201
+
202
+ .nav-bars-picker-empty .demo-navbar
203
+ background #f7 f7 f8
204
+ border-color rgba (0 ,0 ,0 ,0.1 )
205
+
206
+ .theme-dark .nav-bars-picker-empty .demo-navbar
207
+ background #1b 1b 1b
208
+ border-color #28 28 29
209
+
210
+ .nav-bars-picker-empty .demo-navbar :before ,
211
+ .nav-bars-picker-empty .demo-navbar :after
212
+ background var (-- f7-theme-color )
213
+
214
+ .nav-bars-picker-fill .demo-navbar
215
+ background var (-- f7-theme-color )
216
+
217
+ .nav-bars-picker-fill .demo-navbar :before ,
218
+ .nav-bars-picker-fill .demo-navbar :after
219
+ background #f f f
118
220
119
- .demo-bars-picker .demo-navbar {
120
- position : absolute ;
121
- left : 0 ;
122
- width : 100% ;
123
- height : 30px ;
124
- top : 0 ;
125
- border-bottom : 1px solid transparent ;
126
- }
127
- .demo-bars-picker .demo-navbar :before {
128
- content : ' ' ;
129
- position : absolute ;
130
- left : 10px ;
131
- width : 20px ;
132
- height : 10px ;
133
- top : 50% ;
134
- margin-top : -5px ;
135
- }
136
- .demo-bars-picker .demo-navbar :after {
137
- content : ' ' ;
138
- position : absolute ;
139
- right : 10px ;
140
- width : 20px ;
141
- height : 10px ;
142
- top : 50% ;
143
- margin-top : -5px ;
144
- }
145
- .demo-bars-picker-empty .demo-navbar {
146
- background : #f7f7f8 ;
147
- border-color : rgba (0 ,0 ,0 ,0.1 );
148
- }
149
- .theme-dark .demo-bars-picker-empty .demo-navbar {
150
- background : #1b1b1b ;
151
- border-color : #282829 ;
152
- }
153
- .demo-bars-picker-empty .demo-navbar :before ,
154
- .demo-bars-picker-empty .demo-navbar :after {
155
- background : var (--f7-theme-color );
156
- }
157
- .demo-bars-picker-fill .demo-navbar {
158
- background : var (--f7-theme-color );
159
- }
160
- .demo-bars-picker-fill .demo-navbar :before ,
161
- .demo-bars-picker-fill .demo-navbar :after {
162
- background : #fff ;
163
- }
164
221
</style >
0 commit comments