mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
b198e6170b
* Removed some unnecessary rendering * Only PureComponents and some other stuff * Removed all functional components * Only deal with nunjucks marks * Remove ref assign functions in modals * Lots of tweaks * A bit snappier * A bit snappier
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
import React, {PropTypes, PureComponent} from 'react';
|
|
import KeyValueEditor from '../../keyvalueeditor/Editor';
|
|
import {trackEvent} from '../../../../analytics/index';
|
|
|
|
class UrlEncodedEditor extends PureComponent {
|
|
_handleTrackToggle = pair => {
|
|
trackEvent('Url Encoded Editor', 'Toggle', pair.disabled ? 'Disable' : 'Enable')
|
|
};
|
|
_handleTrackCreate = () => trackEvent('Url Encoded Editor', 'Create');
|
|
_handleTrackDelete = () => trackEvent('Url Encoded Editor', 'Delete');
|
|
|
|
render () {
|
|
const {parameters, onChange, handleRender} = this.props;
|
|
|
|
return (
|
|
<div className="scrollable-container tall wide">
|
|
<div className="scrollable">
|
|
<KeyValueEditor
|
|
namePlaceholder="name"
|
|
valuePlaceholder="value"
|
|
onChange={onChange}
|
|
handleRender={handleRender}
|
|
onToggleDisable={this._handleTrackToggle}
|
|
onCreate={this._handleTrackCreate}
|
|
onDelete={this._handleTrackDelete}
|
|
pairs={parameters}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
UrlEncodedEditor.propTypes = {
|
|
// Required
|
|
onChange: PropTypes.func.isRequired,
|
|
parameters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
handleRender: PropTypes.func.isRequired,
|
|
};
|
|
|
|
export default UrlEncodedEditor;
|