component: apply PropType plugin to props
This commit is contained in:
parent
78bf7bd632
commit
ffeb447dc1
@ -1,39 +1,46 @@
|
||||
import React from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import classes from './burgerIngredient.css';
|
||||
|
||||
const burgerIngredient = (props) => {
|
||||
let ingredient = null;
|
||||
class BurgerIngredient extends Component {
|
||||
render() {
|
||||
let ingredient = null;
|
||||
|
||||
switch (props.type) {
|
||||
case ('bread-bottom'):
|
||||
ingredient = <div className={classes.BreadBottom}></div>
|
||||
break;
|
||||
case ('bread-top'):
|
||||
ingredient = (
|
||||
<div className={classes.BreadTop}>
|
||||
<div className={classes.Seeds1}></div>
|
||||
<div className={classes.Seeds2}></div>
|
||||
</div>
|
||||
)
|
||||
break;
|
||||
case ('meat'):
|
||||
ingredient = <div className={classes.Meat}></div>
|
||||
break;
|
||||
case ('cheese'):
|
||||
ingredient = <div className={classes.Cheese}></div>
|
||||
break;
|
||||
case ('salad'):
|
||||
ingredient = <div className={classes.Salad}></div>
|
||||
break;
|
||||
case ('bacon'):
|
||||
ingredient = <div className={classes.Bacon}></div>
|
||||
break;
|
||||
default:
|
||||
ingredient = null;
|
||||
break;
|
||||
switch (this.props.type) {
|
||||
case ('bread-bottom'):
|
||||
ingredient = <div className={classes.BreadBottom}></div>
|
||||
break;
|
||||
case ('bread-top'):
|
||||
ingredient = (
|
||||
<div className={classes.BreadTop}>
|
||||
<div className={classes.Seeds1}></div>
|
||||
<div className={classes.Seeds2}></div>
|
||||
</div>
|
||||
)
|
||||
break;
|
||||
case ('meat'):
|
||||
ingredient = <div className={classes.Meat}></div>
|
||||
break;
|
||||
case ('cheese'):
|
||||
ingredient = <div className={classes.Cheese}></div>
|
||||
break;
|
||||
case ('salad'):
|
||||
ingredient = <div className={classes.Salad}></div>
|
||||
break;
|
||||
case ('bacon'):
|
||||
ingredient = <div className={classes.Bacon}></div>
|
||||
break;
|
||||
default:
|
||||
ingredient = null;
|
||||
break;
|
||||
}
|
||||
return ingredient;
|
||||
}
|
||||
|
||||
return ingredient;
|
||||
}
|
||||
|
||||
BurgerIngredient.PropTypes = {
|
||||
type: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
export default burgerIngredient;
|
Loading…
Reference in New Issue
Block a user