@@ -4,8 +4,7 @@ import { css, jsx } from '@emotion/core';
44
55import noop = require( 'lodash/noop' ) ;
66import 'prismjs/components/' ;
7- import * as React from 'react' ;
8- import { CSSProperties , useCallback } from 'react' ;
7+ import { CSSProperties , forwardRef , useCallback } from 'react' ;
98import ReactSimpleCodeEditor from 'react-simple-code-editor' ;
109import { Box } from './Box' ;
1110import { useTheme } from './theme' ;
@@ -56,7 +55,7 @@ export const supportedLanguages = {
5655
5756export type ReactSimpleCodeEditorRef = ReactSimpleCodeEditor ;
5857
59- export const CodeEditor = React . forwardRef < ReactSimpleCodeEditorRef , ICodeEditor > ( ( props , ref ) => {
58+ export const CodeEditor = forwardRef < ReactSimpleCodeEditorRef , ICodeEditor > ( ( props , ref ) => {
6059 const { language, onChange = noop , style, value } = props ;
6160 const highlightCodeCallback = useCallback ( ( ) => highlightCode ( value , language ) , [ value , language ] ) ;
6261 const editorCSS = [ ...codeEditorStyles ( ) ] ;
@@ -68,13 +67,13 @@ export const CodeEditor = React.forwardRef<ReactSimpleCodeEditorRef, ICodeEditor
6867 css : editorCSS ,
6968 } ,
7069 [
71- < ReactSimpleCodeEditor
72- ref = { ref }
73- value = { value }
74- onValueChange = { onChange }
75- highlight = { highlightCodeCallback }
76- padding = { 10 }
77- /> ,
70+ jsx ( ReactSimpleCodeEditor , {
71+ ref,
72+ value,
73+ onValueChange : onChange ,
74+ highlight : highlightCodeCallback ,
75+ padding : 10 ,
76+ } ) ,
7877 ]
7978 ) ;
8079} ) ;
0 commit comments