-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: Available Meals Section #18
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true, | ||
"endOfLine": "lf" | ||
"endOfLine": "auto" | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
import logo from './logo.svg'; | ||
import './App.css'; | ||
import './components/MealCard/mealcard.css'; | ||
import 'bootstrap/dist/css/bootstrap.min.css'; | ||
import Meals from './components/Meals/Meals'; | ||
import './components/Meals/meals.css'; | ||
|
||
function App() { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>src/App.js</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
<Meals /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be removed since in future references this will cause merge conflicts |
||
</div> | ||
); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* eslint-disable react/prop-types */ | ||
import React, { Component } from 'react'; | ||
import { Button } from 'react-bootstrap'; | ||
|
||
export default class MealCard extends Component { | ||
render() { | ||
return ( | ||
<div className="card"> | ||
<img src={this.props.img} className="card-img" alt="food" /> | ||
<div className="card-body"> | ||
<h5 className="card-title">{this.props.title}</h5> | ||
<span className="card-text">{this.props.organization}</span> | ||
<Button className="Button">Get This Meal</Button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from 'react'; | ||
import * as renderer from 'react-test-renderer'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test error here |
||
import MealCard from '../MealCard'; | ||
it('renders apply now correctly', () => { | ||
const tree = renderer.create(<MealCard />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders apply now correctly 1`] = ` | ||
<div | ||
className="card" | ||
> | ||
<img | ||
alt="food" | ||
class="card-img" | ||
/> | ||
<div | ||
class="card-body" | ||
> | ||
<h5 | ||
class="card-title" | ||
/> | ||
<span | ||
class="card-text" | ||
/> | ||
<button | ||
className="Button btn btn-primary" | ||
disabled={false} | ||
type="button" | ||
> | ||
Get This Meal | ||
</button> | ||
</div> | ||
</div> | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.card{ | ||
height: 436px; | ||
width: 270px; | ||
top: 247px; | ||
left: 135px; | ||
} | ||
|
||
.card-body{ | ||
position: relative; | ||
} | ||
|
||
.Button{ | ||
background-color: #E5E5E5; | ||
height: 60px; | ||
width: 100%; | ||
border: 0; | ||
border: none; | ||
color: black; | ||
position: absolute; | ||
bottom: 0; | ||
left: 0; | ||
} | ||
|
||
.Button:hover { | ||
color: #fff; | ||
background-color: #03B664; | ||
border-color: #0062cc; | ||
} | ||
|
||
.card-img { | ||
width: 270px; | ||
height: 270px; | ||
object-fit: cover; | ||
} | ||
|
||
.card-title{ | ||
position: absolute; | ||
|
||
} | ||
|
||
.card-text{ | ||
position: absolute; | ||
bottom: 80px; | ||
left: 18px; | ||
color: gray; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React, { Component } from 'react'; | ||
import { Carousel, CarouselItem } from 'react-bootstrap'; | ||
import MealCard from '../MealCard/MealCard'; | ||
import '../Meals/meals.css'; | ||
|
||
export default class Meals extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<div className="available-meals"> | ||
<h1 className="meals-title">Available Meals Right Now</h1> | ||
<p className="meals-quote"> | ||
`If you dont try this app, you wont become the hero you were meant | ||
to be` | ||
</p> | ||
<Carousel> | ||
<CarouselItem> | ||
<div className="items"> | ||
<MealCard | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i want this to me map array / object so we map it this will help when we reach the back end |
||
img="tomato.jpg" | ||
title="Canned Tomato Soup" | ||
organization="Family Market" | ||
/> | ||
<MealCard | ||
img="donut.jpg" | ||
title="Pastry Box" | ||
organization="Chocolate Bar" | ||
/> | ||
<MealCard | ||
img="pantry.jpg" | ||
title="Two days worth of pantry" | ||
organization="7eleven" | ||
/> | ||
<MealCard | ||
img="rice.jpg" | ||
title="Rice bags" | ||
organization="Sprout Warehouse" | ||
/> | ||
</div> | ||
</CarouselItem> | ||
<CarouselItem> | ||
<div className="items"> | ||
<MealCard | ||
img="tomato.jpg" | ||
title="Canned Tomato Soup" | ||
organization="Family Market" | ||
/> | ||
<MealCard | ||
img="donut.jpg" | ||
title="Pastry Box" | ||
organization="Chocolate Bar" | ||
/> | ||
<MealCard | ||
img="pantry.jpg" | ||
title="Two days worth of pantry" | ||
organization="7eleven" | ||
/> | ||
<MealCard | ||
img="rice.jpg" | ||
title="Rice bags" | ||
organization="Sprout Warehouse" | ||
/> | ||
</div> | ||
</CarouselItem> | ||
</Carousel> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from 'react'; | ||
import * as renderer from 'react-test-renderer'; | ||
import Meals from '../Meals'; | ||
it('renders apply now correctly', () => { | ||
const tree = renderer.create(<Meals />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the library for rendering so the test doesn't fail