import * as React from 'react'; import * as classNames from 'classnames'; import {Component, HTMLProps, MouseEvent} from 'react'; import {Button, Icon, JsonDebugger} from './'; export interface FormActionsProps { loadingStateActiveOnSubmitButton?: boolean; noBackButton?: boolean; noJsonDebugger?: boolean; noSubmitButton?: boolean; objectToDebug?: any; submitButtonDisabled?: boolean; onChangeDebugObject?: (object: any) => void; onClickBackButton?: (e: MouseEvent) => void; } export interface FormActionsState { debugModeEnabled: boolean; } export class FormActions extends Component { static defaultProps: FormActionsProps = { loadingStateActiveOnSubmitButton: false, noBackButton: false, noJsonDebugger: false, noSubmitButton: false, objectToDebug: {}, submitButtonDisabled: false, onChangeDebugObject: () => { return; }, onClickBackButton: () => { return; }, }; state: FormActionsState = { debugModeEnabled: false, }; render() { const { loadingStateActiveOnSubmitButton, noBackButton, noJsonDebugger, noSubmitButton, objectToDebug, submitButtonDisabled, onChangeDebugObject, onClickBackButton} = this.props; const {debugModeEnabled} = this.state; return (
{!noBackButton && ( )} {!noSubmitButton && ( )} {!noJsonDebugger && ( )}
{!noJsonDebugger && debugModeEnabled && (
)}
); } toggleDebugMode = () => { this.setState({debugModeEnabled: !this.state.debugModeEnabled}); } }