forked from TypeCellOS/BlockNote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tsx
More file actions
132 lines (124 loc) · 3.49 KB
/
Copy pathmain.tsx
File metadata and controls
132 lines (124 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import { AppShell, MantineProvider, ScrollArea } from "@mantine/core";
import React from "react";
import { createRoot } from "react-dom/client";
import {
Link,
Outlet,
RouterProvider,
createBrowserRouter,
} from "react-router-dom";
import { App } from "../examples/basic/App";
import { ReactCustomBlocks } from "../examples/react-custom-blocks/App";
import { ReactInlineContent } from "../examples/react-custom-inline-content/App";
import { ReactStyles } from "../examples/react-custom-styles/App";
import { CustomBlocks } from "../examples/vanilla-custom-blocks/App";
import { InlineContent } from "../examples/vanilla-custom-inline-content/App";
import "./style.css";
window.React = React;
const editors = [
{
title: "Basic",
path: "/simple",
component: App,
},
{
title: "React custom styles",
path: "/react-styles",
component: ReactStyles,
},
{
title: "Vanilla Inline content",
path: "/inline-content",
component: InlineContent,
},
{
title: "React inline content",
path: "/react-inline-content",
component: ReactInlineContent,
},
{
title: "Vanilla custom blocks",
path: "/custom-blocks",
component: CustomBlocks,
},
{
title: "React custom blocks",
path: "/react-blocks",
component: ReactCustomBlocks,
},
];
function Root() {
// const linkStyles = (theme) => ({
// root: {
// // background: "red",
// ...theme.fn.hover({
// backgroundColor: "#dfdfdd",
// }),
// "&[data-active]": {
// backgroundColor: "rgba(0, 0, 0, 0.04)",
// },
// },
// // "root:hover": { background: "blue" },
// });
return (
<MantineProvider>
<AppShell
padding={0}
// header={<Header height={60} p="xs">
// {/* Header content */}
// </Header>}
styles={() => ({
main: {
backgroundColor: "white",
// theme.colorScheme === "dark"
// ? theme.colors.dark[8]
// : theme.colors.gray[0],
},
})}>
{window.location.search.includes("hideMenu") ? undefined : (
<AppShell.Navbar w={{ base: 300 }} p="xs">
<AppShell.Section grow component={ScrollArea} mx="-xs" px="xs">
{editors.map((editor, i) => (
<div key={i}>
<Link to={editor.path}>{editor.title}</Link>
</div>
))}
{/* manitne <NavLink
styles={linkStyles}
label="Simple"
onClick={navi}
// icon={<IconGauge size={16} stroke={1.5} />}
// rightSection={<IconChevronRight size={12} stroke={1.5} />}
/>
<NavLink
styles={linkStyles}
label="Two"
// icon={<IconGauge size={16} stroke={1.5} />}
// rightSection={<IconChevronRight size={12} stroke={1.5} />}
/> */}
</AppShell.Section>
</AppShell.Navbar>
)}
<Outlet />
</AppShell>
</MantineProvider>
);
}
const router = createBrowserRouter([
{
path: "/",
element: <Root />,
children: editors.map((editor) => ({
path: editor.path,
element: <editor.component />,
})),
},
]);
const root = createRoot(document.getElementById("root")!);
root.render(
// TODO: StrictMode is causing duplicate mounts and conflicts with collaboration
// <React.StrictMode>
// <App />
<RouterProvider router={router} />
// </React.StrictMode>
);