Skip to content

Commit

Permalink
added data
Browse files Browse the repository at this point in the history
  • Loading branch information
saxenanihal95 committed Dec 28, 2020
1 parent 3fc4027 commit 572843d
Showing 1 changed file with 128 additions and 28 deletions.
156 changes: 128 additions & 28 deletions src/components/Section/Section.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,141 @@
import React from "react";
import React, { useEffect, useState } from "react";
import Card from "../Card/Card";
import Grid from "../Grid/Grid";
import SubTitle from "../SubTitle/SubTitle";
import Title from "../Title/Title";
import "./Section.scss";

import { createServer } from "miragejs";

let server = createServer();
server.get("/api/sections", {
sections: [
{
id: 1,
title: "Meal Deals",
subTitle:
"Grab a bargain and enjoy your favourite Burrito with your favourite drink and desert. Each Burrito, Tortilla filled with rice, pinto beans, with choice of main filling, Pico de Gallo, Cheese and Guacamole as standard.",
items: [
{
id: 1,
title: "Any Burrito + Soft drink + Brownies",
subTitle:
"Each Burrito, Tortilla filled with rice, pinto beans, with choice of main filling, Pico de Gallo, Cheese and Guacamole as standard.",
price: "£11.00",
},
{
id: 2,
title: "2 Burritos + Soft Drink + Brownie",
subTitle:
"2 Burritos + 2 Soft Drink + 2 Brownie Each Burrito, Tortilla filled with rice, pinto beans, with choice of main filling, Pico de Gallo, Cheese and Guacamole as standard.",
price: "£20.00",
},
],
},
{
id: 2,
title: "Classic Burritos",
subTitle: "",
items: [
{
id: 1,
title: "Carne Burrito",
subTitle:
"Large tortilla filled with choice of main filling, Mexican rice, pinto beans, onions and peppers, Pico de gallo, spicy sauce, sour cream, cheese and guacamole. (Vegan burritos come with vegan cheese and sour cream).",
price: "£7.00",
},
{
id: 2,
title: "Vegan Burrito Bowl",
subTitle:
"No Tortilla, but more Filling. Bowl filled with choice of main filling, Mexican rice, pinto beans, onions and peppers, Pico de gallo, spicy sauce (as above), Vegan Mayo, Vegan cheese and guacamole.",
price: "£7.80",
},
{
id: 3,
title: "Veggie Burrito Bowl",
subTitle:
"No Tortilla, but more Filling. Bowl filled with choice of main filling, Mexican rice, pinto beans, onions and peppers, Pico de gallo, spicy sauce (as above), sour cream, cheese and guacamole.",
price: "£7.80",
},
],
},
{
id: 3,
title: "Classic Burrito Bowl",
subTitle:
"Naked Burrito. Box filled with rice, pinto beans, onions and peppers with choice of main filling and salsas. Eat now or later. Our containers are fully microwavable giving you the freedom to eat when you want. They can also be 100% recycled.",
items: [
{
id: 1,
title: "Grande Burrito Bowl",
subTitle:
"No Tortilla, but more Filling. Bowl filled with choice of main filling, Mexican rice, pinto beans, onions and peppers, Pico de gallo, spicy sauce (as above), sour cream, cheese and guacamole.",
price: "£7.80",
},
{
id: 2,
title: "Vegan Burrito Bowl",
subTitle:
"No Tortilla, but more Filling. Bowl filled with choice of main filling, Mexican rice, pinto beans, onions and peppers, Pico de gallo, spicy sauce (as above), sour cream, cheese and guacamole.",
price: "£7.80",
},
{
id: 3,
title: "Veggie Burrito Bowl",
subTitle:
"No Tortilla, but more Filling. Bowl filled with choice of main filling, Mexican rice, pinto beans, onions and peppers, Pico de gallo, spicy sauce (as above), sour cream, cheese and guacamole.",
price: "£7.80",
},
],
},
// { id: 4, title: "Nachos, Tacos and Quesadillas", subTitle: "", items: [] },
// {
// id: 5,
// title: "Jarritos",
// subTitle:
// "A selection of our best sellers soft drinks including Jarritos, refreshing traditional Mexican Sooda.",
// items: [],
// },
// {
// id: 6,
// title: "Soft Drinks",
// subTitle: "",
// items: [],
// },
],
});

export default function Section() {
const [sections, setSections] = useState([]);
useEffect(() => {
fetch("/api/sections")
.then((res) => res.json())
.then((json) => {
setSections(json.sections);
});
}, []);

console.log(sections);

return (
<div className="Section">
<div>
<Title text="Meal Deals" />
<SubTitle
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eget erat
bibendum, cursus libero in, vestibulum mauris. Nulla commodo mi ut
lacinia sollicitudin. Nunc suscipit pellentesque scelerisque. Aliquam
varius, nibh at tempus blandit, dolor arcu cursus tellus, a tristique
lacus risus sed lorem. Sed in accumsan diam. Quisque felis enim,
consectetur ut imperdiet quis, tempus non ligula. Orci varius natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec bibendum at ligula ac rutrum. Mauris ut nunc at nisi tristique
accumsan. Proin a maximus ipsum. Sed eleifend, justo quis tincidunt
bibendum, diam lacus vestibulum enim, vitae viverra ligula dolor vitae
nisl. Morbi luctus egestas dapibus. Vestibulum aliquam dolor nec nisi
lobortis, vitae auctor est luctus. Duis velit augue, cursus ut maximus
vitae, hendrerit a est. Cras viverra tellus libero, in feugiat augue
consequat nec. Aliquam at velit dui."
/>
<Grid>
<Card>
<p>Any Burrito + Soft drink + Brownies</p>
<p>
Each Burrito, Tortilla filled with rice, pinto beans, with choice
of main filling, Pico de Gallo, Cheese and Guacamole as standard.
</p>
<p>£11.00</p>
</Card>
</Grid>
{sections.map((section) => (
<div key={section.id}>
<Title text={section.title} />
<SubTitle text={section.subTitle} />
<Grid>
{section.items.map((item) => (
<Card>
<p>{item.title}</p>
<p>{item.subTitle}</p>
<p>{item.price}</p>
</Card>
))}
</Grid>
</div>
))}
</div>
<div className="OrderContainer">
<Card>
Expand Down

0 comments on commit 572843d

Please sign in to comment.