Commit 180db76 1 parent 4a6923d commit 180db76 Copy full SHA for 180db76
File tree 6 files changed +40
-31
lines changed
src/BootstrapBlazor.Server
6 files changed +40
-31
lines changed Original file line number Diff line number Diff line change 43
43
white-space : nowrap;
44
44
}
45
45
46
- .icon-theme img {
47
- cursor : pointer;
48
- }
49
-
50
- .icon-theme .icon-dark {
51
- display : none;
52
- }
53
-
54
- [data-bs-theme = 'dark' ] .icon-dark {
55
- display : block;
56
- }
57
-
58
- [data-bs-theme = 'dark' ] .icon-light {
59
- display : none;
60
- }
61
-
62
46
@media (min-width : 768px ) {
63
47
.navbar-header {
64
48
position : sticky;
Original file line number Diff line number Diff line change @@ -15,17 +15,19 @@ export function init() {
15
15
prevScrollTop = currentScrollTop
16
16
} )
17
17
18
- const themeElement = document . querySelector ( '.icon-theme' ) ;
19
- if ( themeElement ) {
20
- EventHandler . on ( themeElement , 'click' , e => {
21
- let theme = getPreferredTheme ( ) ;
22
- if ( theme === 'dark' ) {
23
- theme = 'light' ;
24
- }
25
- else {
26
- theme = 'dark' ;
27
- }
28
- setTheme ( theme ) ;
18
+ const themeElements = document . querySelectorAll ( '.icon-theme' ) ;
19
+ if ( themeElements ) {
20
+ themeElements . forEach ( el => {
21
+ EventHandler . on ( el , 'click' , e => {
22
+ let theme = getPreferredTheme ( ) ;
23
+ if ( theme === 'dark' ) {
24
+ theme = 'light' ;
25
+ }
26
+ else {
27
+ theme = 'dark' ;
28
+ }
29
+ setTheme ( theme ) ;
30
+ } ) ;
29
31
} ) ;
30
32
}
31
33
}
Original file line number Diff line number Diff line change
1
+ @inherits ComponentBase
2
+
3
+ <div class =" btn btn-circle btn-fade btn-theme-mode icon-theme d-flex d-sm-none" >
4
+ <img src =" ./images/theme-light.svg" class =" icon-light" />
5
+ <img src =" ./images/theme-night.svg" class =" icon-dark" />
6
+ </div >
Original file line number Diff line number Diff line change 6
6
<main >
7
7
@Body
8
8
9
- <LinkButton TooltipPlacement = " Placement.Left " ButtonStyle = " ButtonStyle.Circle " Color = " Color.None " TooltipText = " @ChatTooltip " class = " btn-fade btn-theme-mode " Url = " ./ai-chat " Icon = " fa-solid fa-comments " ></ LinkButton >
9
+ <ThemeMode / >
10
10
11
11
<LinkButton TooltipPlacement =" Placement.Left" ButtonStyle =" ButtonStyle.Circle" Color =" Color.None" TooltipText =" @ChatTooltip" class =" btn-fade btn-chat" Url =" ./ai-chat" Icon =" fa-solid fa-comments" ></LinkButton >
12
12
Original file line number Diff line number Diff line change 43
43
}
44
44
45
45
::deep .btn-theme-mode {
46
- --bs-btn-bg : # 8759ff ;
47
- --bs-btn-hover-bg : var (--bs-btn-bg );
48
- --bs-btn-active-bg : var (--bs-btn-bg );
46
+ --bs-btn-bg : # 562fff ;
47
+ --bs-btn-hover-bg : # 562fff ;
48
+ --bs-btn-active-bg : # 562fff ;
49
+ box-shadow : 0 0 8px # 6143e2 ;
49
50
bottom : 17rem ;
50
51
right : 1rem ;
51
52
overflow : hidden;
Original file line number Diff line number Diff line change @@ -200,6 +200,22 @@ code {
200
200
background-color : rgba (var (--bs-emphasis-color-rgb ), .1 );
201
201
}
202
202
203
+ .icon-theme img {
204
+ cursor : pointer;
205
+ }
206
+
207
+ .icon-theme .icon-light {
208
+ display : none;
209
+ }
210
+
211
+ [data-bs-theme = 'dark' ] .icon-dark {
212
+ display : none;
213
+ }
214
+
215
+ [data-bs-theme = 'dark' ] .icon-light {
216
+ display : block;
217
+ }
218
+
203
219
@media (min-width : 768px ) {
204
220
: root {
205
221
--bs-header-height : 50px ;
You can’t perform that action at this time.
0 commit comments