Skip to content

Commit

Permalink
fix: Better UI
Browse files Browse the repository at this point in the history
  • Loading branch information
can-keklik committed Jul 22, 2024
1 parent d961da9 commit 9227add
Show file tree
Hide file tree
Showing 3 changed files with 584 additions and 41 deletions.
37 changes: 14 additions & 23 deletions lykiadb-playground/app/editor.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
'use client';
import Editor from "react-simple-code-editor";
import { JsonView, allExpanded, darkStyles } from 'react-json-view-lite';

import React from "react";
import { highlight, languages } from 'prismjs/components/prism-core';
import 'prismjs/components/prism-clike';
import 'prismjs/components/prism-javascript';
import 'prismjs/themes/prism.css';
import CodeEditor from '@uiw/react-textarea-code-editor';
import JsonView from '@uiw/react-json-view';
import 'react-json-view-lite/dist/index.css';
import { defaultFont } from '../styles/fonts'
import SplitPane, { Pane } from 'split-pane-react';
Expand Down Expand Up @@ -35,26 +32,20 @@ const EditorView = () => {

return (
<SplitPane sizes={sizes} onChange={setSizes} className={defaultFont.className}>
<Pane minSize={300}>
<Editor
insertSpaces={true}
value={code}
onValueChange={(code: string) => updateCode(code)}
highlight={
(code: string) => {
return highlight(code, languages.js)
}
}
padding={10}
style={{
fontFamily: '',
fontSize: 16,
}}
/>
<Pane minSize={300} className="h-screen">
<div className="h-full overflow-auto text-md">
<CodeEditor
value={code}
language="js"
placeholder="Please enter JS code."
onChange={(evn) => updateCode(evn.target.value)}
padding={15}
/>
</div>
</Pane>
<Pane minSize={600} className="h-full">
<div className="overflow-y-auto h-full">
<JsonView data={ast} shouldExpandNode={allExpanded} style={darkStyles} />
<JsonView value={ast} />
</div>
</Pane>
</SplitPane>
Expand Down
4 changes: 2 additions & 2 deletions lykiadb-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"lint": "next lint"
},
"dependencies": {
"@uiw/react-json-view": "2.0.0-alpha.25",
"@uiw/react-textarea-code-editor": "^3.0.2",
"next": "14.2.5",
"prismjs": "^1.29.0",
"react": "^18",
"react-dom": "^18",
"react-json-view-lite": "^1.4.0",
"react-simple-code-editor": "^0.14.1",
"split-pane-react": "^0.1.3"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 9227add

Please sign in to comment.