Skip to content
Snippets Groups Projects
Select Git revision
  • 0d8a97d99dd6c01b522ce0a2be94868893568d21
  • master default protected
  • 2023-ujoncdelutan
  • 2023-update
  • 1.4.7 protected
  • 1.4.6 protected
  • 1.4.5 protected
  • 1.4.4 protected
  • 1.4.3 protected
  • 1.4.2 protected
  • 1.4.1 protected
  • 1.4.0 protected
  • 1.3.19 protected
  • 1.3.18 protected
  • 1.3.17 protected
  • 1.3.16 protected
  • 1.3.15 protected
  • 1.3.14 protected
  • 1.3.13 protected
  • 1.3.12 protected
  • 1.3.10 protected
  • 1.3.11 protected
  • 1.3.9 protected
  • 1.3.8 protected
24 results

AddEventForm.js

Blame
  • AddEventForm.js 3.01 KiB
    import { Button, Form, Icon, Input, Modal } from 'semantic-ui-react';
    import React, { Component } from 'react';
    import { addEvent, eventDate, writeEvent } from '../../actions/statistics';
    
    import { DateTimeInput } from 'semantic-ui-calendar-react';
    import { clearWrite } from '../../actions/news';
    import { connect } from 'react-redux';
    
    class AddEventForm extends Component {
      constructor(props) {
        super(props);
        this.state = {
          showModal: false,
          date: '',
        };
      }
    
      // Handling change in redux action creator throws an exception
      // Temporal solotion using the components state to display, instead redux state
      handleChange = (event, { name, value }) => {
        if (this.state.hasOwnProperty(name)) {
          this.setState({ [name]: value });
        }
        this.props.eventDate(name, value);
      };
    
      render() {
        const { name, description } = this.props.newEvent;
        return (
          <Modal
            open={this.state.showModal}
            trigger={
              <Button
                size="big"
                onClick={() => {
                  this.setState({ showModal: true });
                }}
              >
                Alkalom hozzáadása
              </Button>
            }
          >
            <Modal.Header>Új alkalom:</Modal.Header>
            <Modal.Content
              style={{
                paddingTop: '20px',
              }}
            >
              <Form>
                <Form.Field
                  control={Input}
                  label="Név"
                  name="name"
                  onChange={(e) => this.props.writeEvent(e)}
                  value={name}
                  style={{
                    marginBottom: '20px',
                  }}
                  placeholder="Title"
                />
                <Form.TextArea
                  name="description"
                  label="Leírás:"
                  placeholder="Rövid leírás"
                  value={description}
                  onChange={(e) => this.props.writeEvent(e)}
                />
                <DateTimeInput
                  name="date"
                  label="Dátum:"