From bca57e2a9bd32f7f537be59ae05f6366050b2428 Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Mon, 23 Mar 2020 21:29:42 +0100 Subject: [PATCH] Fixed and beautified merge --- smart-hut/{icons.js => icons.txt} | 0 smart-hut/src/components/modalform.js | 159 +++++++++++++++----------- 2 files changed, 91 insertions(+), 68 deletions(-) rename smart-hut/{icons.js => icons.txt} (100%) diff --git a/smart-hut/icons.js b/smart-hut/icons.txt similarity index 100% rename from smart-hut/icons.js rename to smart-hut/icons.txt diff --git a/smart-hut/src/components/modalform.js b/smart-hut/src/components/modalform.js index d5e891e..1e83db8 100644 --- a/smart-hut/src/components/modalform.js +++ b/smart-hut/src/components/modalform.js @@ -16,10 +16,10 @@ export default class ModalWindow extends Component { this.state = { id: "", selectedIcon: "", - name: this.props.type === 'new' ? '' : this.props.idRoom.name, - img: this.props.type === 'new' ? '' : this.props.idRoom.images, - openModal: false - } + name: this.props.type === "new" ? "" : this.props.idRoom.name, + img: this.props.type === "new" ? "" : this.props.idRoom.images, + openModal: false, + }; this.addRoomModal = this.addRoomModal.bind(this); this.updateIcon = this.updateIcon.bind(this); @@ -59,16 +59,10 @@ export default class ModalWindow extends Component { this.setState({ [nam]: val }); }; - let nam = event.target.name; - let val = event.target.value; - this.setState({[nam]: val}); - console.log(this.state); - } - - closeModal = (e) => { - this.setState({openModal:false}); - this.updateIcon('home'); - } + closeModal = (e) => { + this.setState({ openModal: false }); + this.updateIcon("home"); + }; openModal = (e) => { this.setState({ openModal: true }); @@ -93,64 +87,93 @@ export default class ModalWindow extends Component { ADD ROOM - : - - } - - - { - 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:

- - - -
+ +
+ {this.props.type === "new" ? "Add new room" : "Modify room"} +
+ +
+

Insert the name of the room:

+ + + +

Insert an image of the room:

+ + + +
-
-

Select an icon:

- -
+
+

Select an icon:

+ +
- {this.props.type === "modify" ? - : null } + {this.props.type === "modify" ? ( + + ) : null} +
+ + -
- - - - - +