Repository navigation
Expand file tree
/
Copy pathOptions.tsx
More file actions
48 lines (46 loc) · 1.86 KB
/
Copy pathOptions.tsx
File metadata and controls
48 lines (46 loc) · 1.86 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
import { useState } from "react";
import { DrawioEditor, type UrlParameters } from "@drawio/react";
// URL parameters change the look of the editor. A change reloads it with
// the diagram. The configuration customises fonts, colours, styles and
// shape libraries:
// https://www.drawio.com/docs/reference/configure-diagram-editor
export default function Options()
{
const [ui, setUi] = useState<UrlParameters["ui"]>("kennedy");
const [dark, setDark] = useState<UrlParameters["dark"]>("auto");
const [lang, setLang] = useState("en");
return (
<>
<div className="toolbar">
<select value={ui} onChange={(e) => setUi(e.target.value as UrlParameters["ui"])}>
<option value="kennedy">Default</option>
<option value="min">Minimal</option>
<option value="atlas">Atlas</option>
<option value="sketch">Sketch</option>
<option value="simple">Simple</option>
</select>
<select value={String(dark)} onChange={(e) => setDark((e.target.value == "auto") ? "auto" : e.target.value == "true")}>
<option value="auto">Light or dark like the system</option>
<option value="false">Light</option>
<option value="true">Dark</option>
</select>
<select value={lang} onChange={(e) => setLang(e.target.value)}>
<option value="en">English</option>
<option value="de">Deutsch</option>
<option value="fr">Français</option>
<option value="ja">日本語</option>
</select>
</div>
<div style={{ height: 600 }}>
<DrawioEditor
urlParameters={{ ui, dark, lang, libraries: true }}
config={{
defaultLibraries: "general;flowchart",
presetColors: ["E6F4EA", "FCE8E6", "E8F0FE", "FEF7E0"],
defaultVertexStyle: { rounded: "1" }
}}
/>
</div>
</>
);
}