ToolJet/frontend/src/Editor/QueryManager/QueryEditors/Redis.jsx
Arpit a203253131
Feature: adds code preview for codeboxes (#1011)
* preview codeHinter default=true

* adding preview code for codeHinter for table widgets

* previw for codeHinter in eventManager and RestAPI headers tab fixed

* added classes to header tabs

* fixed preview for transformations

* widgets preview for title

* preview for advance tab QueryManager

* preview box for datasource queryeditor

* sql code hinter UI spaces fixed
2021-11-15 11:48:09 +05:30

48 lines
1.1 KiB
JavaScript

import React from 'react';
import 'codemirror/theme/duotone-light.css';
import { changeOption } from './utils';
import { CodeHinter } from '../../CodeBuilder/CodeHinter';
class Redis extends React.Component {
constructor(props) {
super(props);
this.state = {
options: this.props.options,
};
}
componentDidMount() {
this.setState({
options: this.props.options,
});
}
render() {
const { options } = this.state;
return (
<div>
{options && (
<div>
<div className="mb-3 mt-2">
<CodeHinter
height="auto"
currentState={this.props.currentState}
initialValue={options.query}
mode="sql"
placeholder={'PING'}
theme={this.props.darkMode ? 'monokai' : 'duotone-light'}
lineNumbers={true}
className="query-hinter"
onChange={(value) => changeOption(this, 'query', value)}
/>
</div>
</div>
)}
</div>
);
}
}
export { Redis };