import React, { Component } from 'react'; import { Button, Header, Modal, Form, Input, Icon, Responsive } from 'semantic-ui-react' import SelectIcons from "./SelectIcons"; export default class ModalWindow extends Component { constructor(props) { super(props); this.state = { id : "", selectedIcon: "", name: "", img: "", openModal: false } this.addRoomModal = this.addRoomModal.bind(this); this.updateIcon = this.updateIcon.bind(this); } addRoomModal = (e) => { let data = { "icon" : this.state.selectedIcon, "name" : this.state.name, "image" : this.state.img } this.props.addRoom(data); this.closeModal(); } modifyRoomModal = (e) => { let data = { "icon" : this.state.selectedIcon === "" ? this.props.idRoom.icon : this.state.selectedIcon , "name" : this.state.name === ""? this.props.idRoom.name : this.state.name, "image" : this.state.img } this.props.updateRoom(data); this.closeModal(); } deleteRoom = (e) => { this.props.deleteRoom(); this.closeModal(); } changeSomething = (event) => { let nam = event.target.name; let val = event.target.value; this.setState({[nam]: val}); } closeModal = (e) => { this.setState({openModal:false}); this.updateIcon('home'); } openModal = (e) => { this.setState({openModal:true}) } updateIcon(e) { this.setState({selectedIcon : e}) } render(){ const spaceDiv = { background: '#f4f4f4', padding: '10px 10px', margin: '10px 0px' } return (
{this.props.type === "new" ? : } { this.props.type === "new" ? : }
{this.props.type === "new" ? "Add new room" : "Modify room" }

Insert the name of the room:

Insert an image of the room:

Select an icon:

{this.props.type === "modify" ? : "" }
) } }