render()

in frontend/src/components/Things.js [99:147]


    render() {

        const positiveMessage = this.props.positiveMessage;
        const negativeMessage = this.props.negativeMessage;

        let positiveMessageComponent;
        let negativeMessageComponent;

        if (positiveMessage) {
            positiveMessageComponent = 
            <Message positive attached='bottom'
                icon='check'
                header='Success'
                content={positiveMessage}>
            </Message>
        }

        if (negativeMessage) {
            negativeMessageComponent =
            <Message negative attached='bottom'
                icon='exclamation'
                header='Something went wrong'
                content={negativeMessage}>
            </Message>
        }

        return(
            <div>
                {positiveMessageComponent}
                {negativeMessageComponent}
                <Form>
                    <Form.Group inline>
                        <Form.Field inline>
                            <label>Thing name</label>
                            <Input placeholder='' value={this.props.filterText} onChange={this.handleFilterTextChange} />
                        </Form.Field>
                        <Form.Field inline>
                            <Button primary onClick={this.handleSearchRequested} disabled={this.props.searching}>
                                {this.props.searching ? 'Searching' : 'Search'}
                            </Button>
                        </Form.Field>
                        <Form.Field inline>
                            <Button positive onClick={this.handleCreateRequest} disabled={!this.props.filterText}>Create Thing</Button>
                        </Form.Field>
                    </Form.Group>
                </Form>
            </div>
        )
    }