Skip to content

Commit 200a013

Browse files
checkpoint
1 parent e8a17f5 commit 200a013

File tree

4 files changed

+56
-24
lines changed

4 files changed

+56
-24
lines changed

typescript/examples/vite_basic/src/App.tsx

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useState, useEffect } from "react";
55
const 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={{

typescript/src/renderer/JsonDocRenderer.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ export const JsonDocRenderer = ({
3737
viewJson = false,
3838
backrefs = [],
3939
}: JsonDocRendererProps) => {
40-
console.log("page: ", page);
41-
4240
// Use the modular hooks for highlight management
4341
const { highlightCount, currentActiveIndex, navigateToHighlight } =
4442
useHighlights({

typescript/src/renderer/styles/base.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
font-size: var(--jsondoc-font-size-page-title);
2020
line-height: var(--jsondoc-line-height-normal);
2121
font-weight: var(--jsondoc-font-weight-bold);
22-
margin: 0 0 var(--jsondoc-spacing-xs);
22+
margin: 0px 0px var(--jsondoc-spacing-lg) 0px;
2323
padding: var(--jsondoc-spacing-sm) 0px;
2424
}
2525

typescript/src/renderer/styles/table.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
.notion-table-row th,
2727
.notion-table-row td {
28-
border: 1px solid var(--jsondoc-border-medium);
28+
border: 1px solid var(--jsondoc-border-light);
2929
padding: 8px 12px;
3030
vertical-align: top;
3131
white-space: normal;
@@ -36,8 +36,8 @@
3636
}
3737

3838
.notion-table-row th {
39-
background-color: var(--jsondoc-bg-code);
4039
font-weight: var(--jsondoc-font-weight-semibold);
40+
text-align: left;
4141
}
4242

4343
.notion-table-cell-text {

0 commit comments

Comments
 (0)