initial commit
This commit is contained in:
18
src/components/Editor.js
Normal file
18
src/components/Editor.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
import EditorControls from './EditorControls';
|
||||
import EditorTextArea from './EditorTextArea';
|
||||
|
||||
export default function Editor({ content, setContent, contentType }) {
|
||||
const [language, setLanguage] = useState('plain');
|
||||
useEffect(() => {
|
||||
if (contentType) {
|
||||
setLanguage(contentType);
|
||||
}
|
||||
}, [contentType]);
|
||||
|
||||
return <>
|
||||
<EditorControls code={content} language={language} setLanguage={setLanguage} />
|
||||
<EditorTextArea code={content} setCode={setContent} language={language} />
|
||||
</>
|
||||
}
|
||||
Reference in New Issue
Block a user