component: add Modal component

master
oscarzhou 2020-12-12 17:53:26 +13:00
parent 5bd3b73317
commit 874e496526
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,20 @@
.Modal {
position: fixed;
z-index: 500;
background-color: white;
width: 70%;
border: 1px solid #ccc;
box-shadow: 1px 1px 1px black;
padding: 16px;
left: 15%;
top: 30%;
box-sizing: border-box;
transition: all 0.3s ease-out;
}
@media (min-width: 600px) {
.Modal {
width: 500px;
left: calc(50% - 250px);
}
}

View File

@ -0,0 +1,13 @@
import React from 'react';
import classes from './Modal.css';
const modal = (props) => {
return (
<div className={classes.Modal}>
{props.children}
</div>
);
};
export default modal;

View File

@ -3,6 +3,7 @@ import React, { Component } from 'react';
import Aux from '../../hoc/Auxiliary'; import Aux from '../../hoc/Auxiliary';
import Burger from '../../components/Burger/Burger'; import Burger from '../../components/Burger/Burger';
import BuildControls from '../../components/Burger/BuildControls/BuildControls'; import BuildControls from '../../components/Burger/BuildControls/BuildControls';
import Modal from '../../components/UI/Modal/Modal';
const INGREDIENT_PRICE = { const INGREDIENT_PRICE = {
salad: 0.4, salad: 0.4,
@ -86,6 +87,7 @@ class BurgerBuilder extends Component {
return ( return (
<Aux> <Aux>
<Modal />
<Burger ingredients={this.state.ingredients} /> <Burger ingredients={this.state.ingredients} />
<BuildControls <BuildControls
ingredientAdded={this.addIngredientHandler} ingredientAdded={this.addIngredientHandler}