import React from 'react'; import { VariableError } from '../VariableError'; import type { IVariable, IVariableInputBuilder, IVariableProps, IVariableState } from './variableInput.service'; import { VariableInputService } from './variableInput.service'; class BooleanInput extends React.Component { public render() { return (
{!this.props.variable.hideErrors && }
); } private extractValue = (): void => { this.props.onChange({ value: !this.props.variable.value, type: this.props.variable.type, name: this.props.variable.name, }); }; } export class BooleanInputBuilder implements IVariableInputBuilder { public handles(type: string): boolean { return type === 'boolean'; } public getInput(variable: IVariable, onChange: (variable: IVariable) => void) { return ; } } VariableInputService.addInput(new BooleanInputBuilder());