-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a94855
commit 4b37b8a
Showing
8 changed files
with
158 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { | ||
Box, | ||
Button, | ||
Modal, | ||
ModalOverlay, | ||
ModalContent, | ||
ModalHeader, | ||
ModalFooter, | ||
ModalBody, | ||
ModalCloseButton | ||
} from '@chakra-ui/react'; | ||
import JSONEditor from 'jsoneditor'; | ||
import { useRef, useEffect, useCallback, useState } from 'react'; | ||
import 'jsoneditor/dist/jsoneditor.min.css'; | ||
|
||
import Footer from './footer'; | ||
|
||
export default function Editor({ isOpen, onClose }) { | ||
const [editorContainer, setEditorContainer] = useState(null); | ||
|
||
useEffect(() => { | ||
if (!editorContainer) | ||
return; | ||
|
||
const editor = new JSONEditor(editorContainer, { | ||
mode: 'tree', | ||
onChange: () => { | ||
|
||
} | ||
}); | ||
|
||
editor.set({ phasmo: 1, money: { value: 2, currency: '$' }, 1: '2', 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'}); | ||
|
||
return () => editor.destroy(); | ||
}, [editorContainer]); | ||
|
||
const editorContainerRef = useCallback(node => { | ||
if (node) | ||
setEditorContainer(node); | ||
}, []); | ||
|
||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose} size='full' mt='20'> | ||
<ModalOverlay /> | ||
<ModalContent> | ||
<ModalHeader>Editor</ModalHeader> | ||
<ModalBody mt='5'> | ||
<div ref={editorContainerRef}></div> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Footer left /> | ||
<Button colorScheme='teal'>Save</Button> | ||
<Button ml='3' onClick={onClose}>Close</Button> | ||
</ModalFooter> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Box, Link, Text } from '@chakra-ui/react'; | ||
import NextLink from 'next/link'; | ||
|
||
export default function Footer({ left }) { | ||
const offset = left ? '10px' : '5px'; | ||
|
||
return ( | ||
<Box position='fixed' bottom={offset} left={left ? offset : undefined} right={left ? undefined : offset} textAlign={left ? 'left' : 'right'}> | ||
<Link as={NextLink} href='/terms-of-service' color='blue.500' mr='6.5px'>Terms of Service</Link> | ||
<Link as={NextLink} href='/privacy-policy' color='blue.500'>Privacy Policy</Link> | ||
<Text>Made with <span style={{ color: 'red' }}>♥</span> by <Link as={NextLink} href='https://alex.tusinean.ro' color='blue.500'>Alex Tușinean</Link></Text> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.jsoneditor-outer > .jsoneditor-tree { | ||
overflow: scroll; | ||
min-height: 70vh; | ||
max-height: 70vh; | ||
} | ||
|
||
.jsoneditor-search > div > input { | ||
background-color: #fff; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters