import React, { Component } from "react";
import Dialog from "../Dialog";
import hardware from "../../data/hardware.json";
import withStyles from '@mui/styles/withStyles';
import Link from "@mui/material/Link";
import Typography from "@mui/material/Typography";
import IconButton from "@mui/material/IconButton";
import ImageList from "@mui/material/ImageList";
import ImageListItem from "@mui/material/ImageListItem";
import ImageListItemBar from "@mui/material/ImageListItemBar";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faExpandAlt } from "@fortawesome/free-solid-svg-icons";
import * as Blockly from "blockly";
import { isWidthDown } from "@material-ui/core";
// FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth
const withWidth = () => (WrappedComponent) => (props) => ;
const styles = (theme) => ({
expand: {
"&:hover": {
color: theme.palette.primary.main,
},
"&:active": {
color: theme.palette.primary.main,
},
color: theme.palette.text.primary,
},
multiImageListItem: {
background: theme.palette.primary.main,
opacity: 0.9,
height: "30px",
},
multiImageListItemTitle: {
color: theme.palette.text.primary,
},
});
class Hardware extends Component {
state = {
open: false,
hardwareInfo: {},
};
handleClickOpen = (hardwareInfo) => {
this.setState({ open: true, hardwareInfo });
};
handleClose = () => {
this.setState({ open: false, hardwareInfo: {} });
};
render() {
var cols = isWidthDown("md", this.props.width)
? isWidthDown("sm", this.props.width)
? isWidthDown("xs", this.props.width)
? 2
: 3
: 4
: 6;
return (
{Blockly.Msg.tutorials_hardware_head}
{this.props.picture.map((picture, i) => {
var hardwareInfo = hardware.filter(
(hardware) => hardware.id === picture
)[0];
return (

this.handleClickOpen(hardwareInfo)}
/>
{hardwareInfo.name}
}
actionIcon={
this.handleClickOpen(hardwareInfo)}
size="large">
}
/>
);
})}
);
}
}
export default withWidth()(withStyles(styles, { withTheme: true })(Hardware));