Compare commits
No commits in common. "cf733097b808c5ce1715d153e3b449bbea12cd1c" and "84a2cc7bddf6916213e95799adde869556e4865e" have entirely different histories.
cf733097b8
...
84a2cc7bdd
@ -1,6 +1,4 @@
|
|||||||
import classes from "./AvailableMeals.module.css";
|
import classes from "./AvailableMeals.module.css";
|
||||||
import Card from "../UI/Card";
|
|
||||||
import MealItem from "./MealItem/MealItem";
|
|
||||||
|
|
||||||
const DUMMY_MEALS = [
|
const DUMMY_MEALS = [
|
||||||
{
|
{
|
||||||
@ -30,21 +28,11 @@ const DUMMY_MEALS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const AvailableMeals = () => {
|
const AvailableMeals = () => {
|
||||||
const mealsList = DUMMY_MEALS.map((meal) => (
|
const mealsList = DUMMY_MEALS.map((meal) => <li>{meal.name}</li>);
|
||||||
<MealItem
|
|
||||||
id={meal.id}
|
|
||||||
key={meal.id}
|
|
||||||
name={meal.name}
|
|
||||||
description={meal.description}
|
|
||||||
price={meal.price}
|
|
||||||
/>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={classes.meals}>
|
<section className={classes.meals}>
|
||||||
<Card>
|
|
||||||
<ul>{mealsList}</ul>
|
<ul>{mealsList}</ul>
|
||||||
</Card>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
import classes from "./MealItem.module.css";
|
|
||||||
import MealItemForm from "./MealItemForm";
|
|
||||||
|
|
||||||
const MealItem = (props) => {
|
|
||||||
const price = `$${props.price.toFixed(2)}`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<li className={classes.meal}>
|
|
||||||
<div>
|
|
||||||
<h3>{props.name}</h3>
|
|
||||||
<div className={classes.description}>{props.description}</div>
|
|
||||||
<div className={classes.price}>{price}</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<MealItemForm id={props.id} />
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MealItem;
|
|
@ -1,22 +0,0 @@
|
|||||||
.meal {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin: 1rem;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
border-bottom: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.meal h3 {
|
|
||||||
margin: 0 0 0.25rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
.price {
|
|
||||||
margin-top: 0.25rem;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #ad5502;
|
|
||||||
font-size: 1.25rem;
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
import classes from "./MealItemForm.module.css";
|
|
||||||
import Input from "../../UI/Input";
|
|
||||||
|
|
||||||
const MealItemForm = (props) => {
|
|
||||||
return (
|
|
||||||
<form className={classes.form}>
|
|
||||||
<Input
|
|
||||||
label="Amount"
|
|
||||||
input={{
|
|
||||||
id: "amount_" + props.id,
|
|
||||||
type: "number",
|
|
||||||
min: "1",
|
|
||||||
max: "5",
|
|
||||||
step: "1",
|
|
||||||
defaultValue: "1",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<button>+ Add</button>
|
|
||||||
</form>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MealItemForm;
|
|
@ -1,20 +0,0 @@
|
|||||||
.form {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form button {
|
|
||||||
font: inherit;
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #8a2b06;
|
|
||||||
border: 1px solid #8a2b06;
|
|
||||||
color: white;
|
|
||||||
padding: 0.25rem 2rem;
|
|
||||||
border-radius: 20px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form button:hover,
|
|
||||||
.form button:active {
|
|
||||||
background-color: #641e03;
|
|
||||||
border-color: #641e03;
|
|
||||||
}
|
|
@ -4,8 +4,8 @@ import AvailableMeals from "./AvailableMeals";
|
|||||||
const Meals = () => {
|
const Meals = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MealsSummary />
|
|
||||||
<AvailableMeals />
|
<AvailableMeals />
|
||||||
|
<MealsSummary />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
import classes from "./Card.module.css";
|
|
||||||
|
|
||||||
const Card = (props) => {
|
|
||||||
return <div className={classes.card}>{props.children}</div>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Card;
|
|
@ -1,6 +0,0 @@
|
|||||||
.card {
|
|
||||||
padding: 1rem;
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
|
|
||||||
border-radius: 14px;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
import classes from "./Input.module.css";
|
|
||||||
|
|
||||||
const Input = (props) => {
|
|
||||||
return (
|
|
||||||
<div className={classes.input}>
|
|
||||||
<label htmlFor={props.input.id}>{props.label}</label>
|
|
||||||
<input id={props.input.id} {...props.input} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Input;
|
|
@ -1,18 +0,0 @@
|
|||||||
.input {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input label {
|
|
||||||
font-weight: bold;
|
|
||||||
margin-right: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input input {
|
|
||||||
width: 3rem;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
font: inherit;
|
|
||||||
padding-left: 0.5rem;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user