diff --git a/src/components/Tutorial/Builder/Hardware.js b/src/components/Tutorial/Builder/Hardware.js index 1d52562..bea2e9a 100644 --- a/src/components/Tutorial/Builder/Hardware.js +++ b/src/components/Tutorial/Builder/Hardware.js @@ -23,6 +23,7 @@ const styles = theme => ({ color: theme.palette.text.primary }, border: { + cursor: 'pointer', '&:hover': { width: 'calc(100% - 4px)', height: 'calc(100% - 4px)', @@ -30,6 +31,7 @@ const styles = theme => ({ } }, active: { + cursor: 'pointer', width: 'calc(100% - 4px)', height: 'calc(100% - 4px)', border: `2px solid ${theme.palette.primary.main}` @@ -71,13 +73,13 @@ class Requirements extends Component { {hardware.map((picture,i) => ( this.onChange(picture.id)} classes={{tile: this.props.value.filter(value => value === picture.id).length > 0 ? this.props.classes.active : this.props.classes.border}}>
- {picture.name} + {picture.name}
- {picture.id} + {picture.name} } /> diff --git a/src/components/Tutorial/Builder/Id.js b/src/components/Tutorial/Builder/Id.js index e329d77..eb9742e 100644 --- a/src/components/Tutorial/Builder/Id.js +++ b/src/components/Tutorial/Builder/Id.js @@ -52,7 +52,8 @@ class Id extends Component { render() { return ( - +
+ ID {this.props.error.id ? Gib eine positive ganzzahlige Zahl ein. : null} + Beachte, dass die ID eindeutig sein muss. Sie muss sich also zu den anderen Tutorials unterscheiden. +
); }; } diff --git a/src/components/Tutorial/Hardware.js b/src/components/Tutorial/Hardware.js index b1c5351..a583ebb 100644 --- a/src/components/Tutorial/Hardware.js +++ b/src/components/Tutorial/Hardware.js @@ -2,9 +2,12 @@ import React, { Component } from 'react'; import Dialog from '../Dialog'; +import hardware from '../../data/hardware.json'; + import { fade } from '@material-ui/core/styles/colorManipulator'; import { withStyles } from '@material-ui/core/styles'; import withWidth, { isWidthDown } from '@material-ui/core/withWidth'; +import Link from '@material-ui/core/Link'; import Typography from '@material-ui/core/Typography'; import IconButton from '@material-ui/core/IconButton'; import GridList from '@material-ui/core/GridList'; @@ -38,16 +41,15 @@ class Hardware extends Component { state = { open: false, - title: '', - url: '' + hardwareInfo: {} }; - handleClickOpen = (title, url) => { - this.setState({open: true, title, url}); + handleClickOpen = (hardwareInfo) => { + this.setState({open: true, hardwareInfo}); }; handleClose = () => { - this.setState({open: false, title: '', url: ''}); + this.setState({open: false, hardwareInfo: {}}); }; render() { @@ -57,38 +59,43 @@ class Hardware extends Component { Für die Umsetzung benötigst du folgende Hardware: - {this.props.picture.map((picture,i) => ( - -
- {picture} this.handleClickOpen(picture, `/media/hardware/${picture}.png`)}/> -
- - {picture} - - } - actionIcon={ - this.handleClickOpen(picture, `/media/hardware/${picture}.png`)}> - - - } - /> -
- ))} + {this.props.picture.map((picture,i) => { + var hardwareInfo = hardware.filter(hardware => hardware.id === picture)[0]; + return( + +
+ {hardwareInfo.name} this.handleClickOpen(hardwareInfo)}/> +
+ + {hardwareInfo.name} + + } + actionIcon={ + this.handleClickOpen(hardwareInfo)}> + + + } + /> +
+ )})}
- {this.state.title}/ +
+ {this.state.hardwareInfo.name}/ + Weitere Informationen unter: {this.state.hardwareInfo.url} +
diff --git a/src/data/hardware.json b/src/data/hardware.json index 575afa3..19fdc06 100644 --- a/src/data/hardware.json +++ b/src/data/hardware.json @@ -1,128 +1,128 @@ [ { "id": "bmp280", - "name": "", + "name": "Luftdruck und Temperatursensor", "src": "bmp280.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "breadboard", - "name": "", + "name": "Steckboard", "src": "breadboard.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "button", - "name": "", + "name": "Knopf", "src": "button.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "hc04", - "name": "", + "name": "Ultraschall-Distanzsensor", "src": "hc04.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "hdc1080", - "name": "", + "name": "Temperatur und Luftfeuchtigkeitssensor", "src": "hdc1080.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "jst-adapter", - "name": "", + "name": "JST-Adapterkabel", "src": "jst-adapter.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "jst-jst", - "name": "", + "name": "JST-JST Kabel", "src": "jst-jst.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "jumperwire", - "name": "", + "name": "Steckkabel", "src": "jumperwire.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "ldr", - "name": "", + "name": "LDR", "src": "ldr.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "led", - "name": "", + "name": "LEDs", "src": "led.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "microphone", - "name": "", + "name": "Mikrofon", "src": "microphone.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "oled", - "name": "", + "name": "OLED-Display", "src": "oled.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "piezo", - "name": "", + "name": "Piezo", "src": "piezo.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "resistor-10kohm", - "name": "", + "name": "10 kOhm Widerstand", "src": "resistor-10kohm.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "resistor-470ohm", - "name": "", + "name": "470 Ohm Widerstand", "src": "resistor-470ohm.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "rgb-led", - "name": "", + "name": "RGB-LED", "src": "rgb-led.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "sd-bee", - "name": "", + "name": "mSD-Bee", "src": "sd-bee.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "senseboxmcu", - "name": "", + "name": "senseBox MCU", "src": "senseboxmcu.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "usb-cable", - "name": "", + "name": "USB-Kabel", "src": "usb-cable.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "veml6070", - "name": "", + "name": "Helligkeit und UV-Sensor", "src": "veml6070.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" }, { "id": "wifi-bee", - "name": "", + "name": "WiFi-Bee", "src": "wifi-bee.png", - "url": "" + "url": "https://sensebox.github.io/books-v2/blockly/de/uebersicht/sensebox_components.html" } ]