@@ -5,6 +5,7 @@ import { useState, useEffect } from "react";
55const App = ( ) => {
66 const [ testPage , setTestPage ] = useState ( null ) ;
77 const [ devMode , setDevMode ] = useState ( false ) ;
8+ const [ theme , setTheme ] = useState < "light" | "dark" > ( "dark" ) ;
89
910 useEffect ( ( ) => {
1011 const loadData = async ( ) => {
@@ -24,22 +25,26 @@ const App = () => {
2425 }
2526
2627 // Test backrefs for highlighting
27- const testBackrefs = [
28- {
29- end_idx : 50 ,
30- block_id : "bk_01jxwgvye6er08spmyxj99f6cp" ,
31- start_idx : 0 ,
32- } ,
33- {
34- end_idx : 100 ,
35- block_id : "bk_01jxwgvydyfj6rhm125q1rd4h8" ,
36- start_idx : 70 ,
37- } ,
38- {
39- end_idx : 80 ,
40- block_id : "bk_01jxwgvydze3bsy2p19cfteqge" ,
41- start_idx : 20 ,
42- } ,
28+ const testBackrefs : Array < {
29+ end_idx : number ;
30+ block_id : string ;
31+ start_idx : number ;
32+ } > = [
33+ // {
34+ // end_idx: 50,
35+ // block_id: "blk_table_row_5",
36+ // start_idx: 0,
37+ // },
38+ // {
39+ // end_idx: 40,
40+ // block_id: "blk_toggle_1",
41+ // start_idx: 12,
42+ // },
43+ // {
44+ // end_idx: 80,
45+ // block_id: "bk_01jxwgvydze3bsy2p19cfteqge",
46+ // start_idx: 20,
47+ // },
4348 // {
4449 // block_id: "bk_01jxwgvyehecbb2bv3jtnm9bzx",
4550 // start_idx: 0,
@@ -55,7 +60,7 @@ const App = () => {
5560 return (
5661 < div
5762 style = { {
58- background : " oklch(20.5% 0 0)",
63+ background : theme === "dark" ? " oklch(20.5% 0 0)" : "oklch(95 % 0 0)",
5964 } }
6065 >
6166 { /* Floating Dev Mode Button */ }
@@ -85,21 +90,50 @@ const App = () => {
8590 { devMode ? "Disable" : "Enable" } Dev Mode
8691 </ button >
8792
93+ { /* Floating Theme Toggle Button */ }
94+ < button
95+ onClick = { ( ) => setTheme ( theme === "dark" ? "light" : "dark" ) }
96+ style = { {
97+ position : "fixed" ,
98+ top : "20px" ,
99+ right : "200px" ,
100+ zIndex : 1000 ,
101+ padding : "8px 16px" ,
102+ background :
103+ theme === "dark" ? "oklch(60% 0.2 50)" : "oklch(40% 0.2 50)" ,
104+ color : "white" ,
105+ border : "none" ,
106+ borderRadius : "4px" ,
107+ cursor : "pointer" ,
108+ boxShadow : "0 4px 12px rgba(0, 0, 0, 0.3)" ,
109+ transition : "all 0.2s ease" ,
110+ } }
111+ onMouseEnter = { ( e ) => {
112+ e . currentTarget . style . transform = "scale(1.05)" ;
113+ } }
114+ onMouseLeave = { ( e ) => {
115+ e . currentTarget . style . transform = "scale(1)" ;
116+ } }
117+ >
118+ { theme === "dark" ? "☀️ Light" : "🌙 Dark" } Mode
119+ </ button >
120+
88121 < div
89122 style = { {
90123 padding : "20px" ,
91124 maxWidth : "300px" ,
92125 // background: "oklch(20.5% 0 0)",
93126 margin : "0 auto" ,
94- color : " oklch(90% 0 0)",
127+ color : theme === "dark" ? " oklch(90% 0 0)" : "oklch(10 % 0 0)",
95128 display : "flex" ,
96129 justifyContent : "center" ,
130+ paddingTop : 160 ,
97131 } }
98132 >
99133 < div >
100134 < JsonDocRenderer
101135 page = { testPage }
102- theme = "dark"
136+ theme = { theme }
103137 devMode = { devMode }
104138 backrefs = { testBackrefs }
105139 components = { {
0 commit comments