import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { addStep, removeStep, changeStepIndex } from '../../../actions/tutorialBuilderActions'; import clsx from 'clsx'; import Textfield from './Textfield'; import StepType from './StepType'; import BlocklyExample from './BlocklyExample'; import Requirements from './Requirements'; import Hardware from './Hardware'; import Media from './Media'; import { withStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import IconButton from '@material-ui/core/IconButton'; import Tooltip from '@material-ui/core/Tooltip'; import { faPlus, faAngleDoubleUp, faAngleDoubleDown, faTrash } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import MarkdownEditor from "./MarkdownEditor"; const styles = (theme) => ({ button: { backgroundColor: theme.palette.primary.main, color: theme.palette.primary.contrastText, width: '40px', height: '40px', '&:hover': { backgroundColor: theme.palette.primary.main, color: theme.palette.primary.contrastText, } }, delete: { backgroundColor: theme.palette.error.dark, color: theme.palette.error.contrastText, '&:hover': { backgroundColor: theme.palette.error.dark, color: theme.palette.error.contrastText, } } }); class Step extends Component { render() { var index = this.props.index; var steps = this.props.steps; return (
Schritt {index + 1}
this.props.addStep(index + 1)} > {index !== 0 ?
this.props.changeStepIndex(index, index - 1)} > this.props.changeStepIndex(index, index + 1)} > this.props.removeStep(index)} >
: null}
{index === 0 ?
: null} {this.props.step.type === 'instruction' ? : null}
); }; } Step.propTypes = { addStep: PropTypes.func.isRequired, removeStep: PropTypes.func.isRequired, changeStepIndex: PropTypes.func.isRequired, steps: PropTypes.array.isRequired, change: PropTypes.number.isRequired, error: PropTypes.object.isRequired, }; const mapStateToProps = state => ({ steps: state.builder.steps, change: state.builder.change, error: state.builder.error }); export default connect(mapStateToProps, { addStep, removeStep, changeStepIndex })(withStyles(styles, { withTheme: true })(Step));