File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 < link href ="../src/css/sgds.css " rel ="stylesheet " type ="text/css " />
88 < link href ="./css/utility.css " rel ="stylesheet " type ="text/css " />
99 < style >
10+ body {
11+ background-color : var (--sgds-bg-default );
12+ transition : background-color 0.2s ;
13+ }
1014 .container {
1115 max-width : 800px ;
1216 margin : 36px auto;
1317 display : flex;
1418 flex-direction : column;
1519 gap : 36px ;
1620 }
21+ .toggle-bar {
22+ position : sticky;
23+ top : 0 ;
24+ z-index : 100 ;
25+ display : flex;
26+ align-items : center;
27+ gap : 12px ;
28+ padding : 12px 16px ;
29+ background-color : var (--sgds-surface-raised );
30+ border-radius : 8px ;
31+ }
32+ .toggle-bar label {
33+ font-weight : 600 ;
34+ font-size : 14px ;
35+ }
1736 </ style >
1837 </ head >
1938 < body >
2039 < div class ="container ">
40+ < div class ="toggle-bar ">
41+ < label > Theme:</ label >
42+ < sgds-button id ="theme-toggle " size ="sm " variant ="outline "> Switch to Night Mode</ sgds-button >
43+ </ div >
2144 < div >
2245 < h2 > Info (default)</ h2 >
2346 < sgds-alert show variant ="info " title ="Info Alert " dismissible >
@@ -160,5 +183,16 @@ <h2>Action slot — Outlined</h2>
160183 </ sgds-alert >
161184 </ div >
162185 </ div >
186+
187+ < script >
188+ const toggleBtn = document . getElementById ( "theme-toggle" ) ;
189+ let isDark = false ;
190+
191+ toggleBtn . addEventListener ( "click" , ( ) => {
192+ isDark = ! isDark ;
193+ document . documentElement . classList . toggle ( "sgds-night-theme" , isDark ) ;
194+ toggleBtn . textContent = isDark ? "Switch to Day Mode" : "Switch to Night Mode" ;
195+ } ) ;
196+ </ script >
163197 </ body >
164198</ html >
Original file line number Diff line number Diff line change 33}
44
55: host ([variant = "warning" ]) .alert {
6- --sgds-alert-color : var (--sgds-warning -fixed-dark );
6+ --sgds-alert-color : var (--sgds-color -fixed-dark );
77 background-color : var (--sgds-warning-surface-default );
88}
99
You can’t perform that action at this time.
0 commit comments