fix: code style

This commit is contained in:
cha0s 2022-03-18 17:34:58 -05:00
parent 0395c41ef6
commit f72d4a9d35
4 changed files with 21 additions and 6 deletions

View File

@ -1,5 +1,3 @@
import './component.scss';
import {Code} from '@avocado/react';
import {useJsonPatcher} from '@avocado/resource-persea';
import {
@ -7,17 +5,26 @@ import {
React,
} from '@flecks/react';
const ScriptComponent = ({path, resource}) => {
import locals from './component.module.scss';
const ScriptComponent = ({
path,
resource,
}) => {
const patch = useJsonPatcher();
return (
<Code
className={locals.code}
code={resource}
fontSize={14}
name={path}
onChange={patch.onChange(path)}
/>
);
};
ScriptComponent.defaultProps = {};
ScriptComponent.displayName = 'ScriptComponent';
ScriptComponent.propTypes = {

View File

@ -0,0 +1,7 @@
.code {
height: 100% !important;
:global .ace_mobile-menu {
display: none;
}
}

View File

@ -1,3 +0,0 @@
.text-renderer {
font-family: monospace;
}

View File

@ -9,6 +9,7 @@ import 'ace-builds/src-noconflict/mode-javascript';
import 'ace-builds/src-noconflict/theme-monokai';
const Code = ({
className,
code,
fontSize,
height,
@ -16,6 +17,7 @@ const Code = ({
onChange,
}) => (
<AceEditor
className={className}
name={name.replace(/[^a-zA-Z0-9]/g, '-')}
fontSize={fontSize}
height={height || `${code.split('\n').length}em`}
@ -29,6 +31,7 @@ const Code = ({
);
Code.defaultProps = {
className: '',
fontSize: 12,
height: null,
onChange: () => {},
@ -36,6 +39,7 @@ Code.defaultProps = {
};
Code.propTypes = {
className: PropTypes.string,
code: PropTypes.string.isRequired,
fontSize: PropTypes.number,
height: PropTypes.string,