component: add Modal component
This commit is contained in:
parent
5bd3b73317
commit
874e496526
src
20
src/components/UI/Modal/Modal.css
Normal file
20
src/components/UI/Modal/Modal.css
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
13
src/components/UI/Modal/Modal.js
Normal file
13
src/components/UI/Modal/Modal.js
Normal 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;
|
@ -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}
|
||||||
|
Loading…
Reference in New Issue
Block a user