diff --git a/smart-hut/src/components/SelectIcons.js b/smart-hut/src/components/SelectIcons.js index e7d57a1..e9d23f6 100644 --- a/smart-hut/src/components/SelectIcons.js +++ b/smart-hut/src/components/SelectIcons.js @@ -2,6 +2,24 @@ import React, { Component } from 'react'; import { Button, Header, Image, Modal, Checkbox, Form, Grid, Input, Icon } from 'semantic-ui-react' export default class SelectIcons extends Component { + + constructor(props) { + super(props); + this.state = { + currentIcon: this.props.currentIcon + } + } + + selectIcon = (e) => { + let el = e.target.name; + if (e.target.tagName === "I"){ + console.log(e.target.parentNode); + el = e.target.parentNode.name; + } + this.props.updateIcon(el); + this.setState({currentIcon : el}) + } + render(){ const myicons = [['home', 'coffee', 'beer', 'glass martini', 'film', 'video'], ['music', 'headphones', 'fax', 'phone', 'laptop','bath'], @@ -17,10 +35,10 @@ export default class SelectIcons extends Component { { myicons.map((e, i) => { return ( - - {e.map((e) => { - return( - } closeIcon> + +
{this.props.type == "new" ? "Add new room" : "Modify room" }

Insert the name of the room:

- +

Insert an image of the room:

- +

Select an icon:

- +
- + : null }
- -
diff --git a/smart-hut/src/views/Navbar.js b/smart-hut/src/views/Navbar.js index 30a2f20..c887f59 100644 --- a/smart-hut/src/views/Navbar.js +++ b/smart-hut/src/views/Navbar.js @@ -13,7 +13,7 @@ class Navbar extends Component { } showForm = (event) => { - console.log(event.target.name); + console.log(event); if (event === "new"){ console.log("funziona"); return () @@ -34,10 +34,10 @@ class Navbar extends Component { - + - + { return ( - + {e.name} @@ -93,7 +94,7 @@ class Navbar extends Component { - +