-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
268 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"C_Cpp.errorSquiggles": "Enabled" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import React from 'react'; | ||
import {Card, CardImg, CardBody, CardTitle,CardText} from 'reactstrap'; | ||
|
||
class DishDetail extends React.Component{ | ||
|
||
renderDish(dish) { | ||
if (dish != null) { | ||
return ( | ||
<div className='col-12 col-md-5 m-1'> | ||
<Card> | ||
<CardImg width="100%" src={dish.image} alt={dish.name} /> | ||
<CardBody> | ||
<CardTitle>{dish.name}</CardTitle> | ||
<CardText>{dish.description}</CardText> | ||
</CardBody> | ||
</Card> | ||
</div> | ||
) | ||
} | ||
else { | ||
return (<div></div>) | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
renderComment(comments){ | ||
if(comments == null){ | ||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
const com = comments.map(comment =>{ | ||
return( | ||
<li key= {comment.id}> | ||
<p> | ||
{comment.id} | ||
</p> | ||
<p> | ||
{comment.author} | ||
date: {comment.date} | ||
</p> | ||
|
||
</li> | ||
) | ||
}) | ||
return( | ||
<div className="col-12 col-md-5 m-1"> | ||
<h4>Comments</h4> | ||
<ul className="list-unstyled"> | ||
{com} | ||
</ul> | ||
</div> | ||
) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
render() | ||
{ | ||
const dish = this.props.dish; | ||
|
||
if(dish == null) | ||
return( | ||
<div> | ||
|
||
</div> | ||
) | ||
const dishItem= this.renderDish(dish); | ||
const comment = this.renderComment(dish.comments); | ||
return( | ||
<div className="row"> | ||
{dishItem} | ||
{comment} | ||
</div> | ||
) | ||
} | ||
|
||
} | ||
|
||
export default DishDetail; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
import { Card, CardImg, CardImgOverlay, CardTitle } from 'reactstrap'; | ||
import Dishdetail from './DishDetail' | ||
import { DISHES } from '../shared/dishes'; | ||
|
||
class Menu extends React.Component{ | ||
constructor(props) | ||
{ | ||
super(props); | ||
this.state={ | ||
selectedDish: null | ||
} | ||
} | ||
|
||
onSelectedDish(dish) | ||
{ | ||
this.setState({ | ||
selectedDish: dish | ||
}) | ||
} | ||
|
||
|
||
render(){ | ||
|
||
|
||
const menu = this.props.dishes.map(dish => { | ||
return ( | ||
<div key={dish.id} className='col-12 col-md-5 m-1'> | ||
<Card onClick={() => this.onSelectedDish(dish)} > | ||
<CardImg width="100%" src={dish.image} alt={dish.name} /> | ||
<CardImgOverlay> | ||
<CardTitle >{dish.name}</CardTitle> | ||
</CardImgOverlay> | ||
</Card> | ||
</div> | ||
); | ||
}); | ||
return( | ||
<div className="container"> | ||
<div className="row"> | ||
{menu} | ||
</div> | ||
<Dishdetail dish={this.state.selectedDish}></Dishdetail> | ||
</div> | ||
) | ||
|
||
} | ||
} | ||
|
||
export default Menu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import React from 'react'; | ||
import {Card, CardImg, CardBody, CardTitle,CardText} from 'reactstrap'; | ||
|
||
class DishDetail extends React.Component{ | ||
|
||
renderDish(dish) { | ||
if (dish != null) { | ||
return ( | ||
<div className='col-12 col-md-5 m-1'> | ||
<Card> | ||
<CardImg width="100%" src={dish.image} alt={dish.name} /> | ||
<CardBody> | ||
<CardTitle>{dish.name}</CardTitle> | ||
<CardText>{dish.description}</CardText> | ||
</CardBody> | ||
</Card> | ||
</div> | ||
) | ||
} | ||
else { | ||
return (<div></div>) | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
renderComment(comments){ | ||
if(comments == null){ | ||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
const com = comments.map(comment =>{ | ||
return( | ||
<li key= {comment.id}> | ||
<p> | ||
{comment.id} | ||
</p> | ||
<p> | ||
{comment.author} &n | ||
date: {comment.date} | ||
</p> | ||
|
||
</li> | ||
) | ||
}) | ||
return( | ||
<div className="col-12 col-md-5 m-1"> | ||
<h4>Comments</h4> | ||
<ul className="list-unstyled"> | ||
{com} | ||
</ul> | ||
</div> | ||
) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
render() | ||
{ | ||
const dish = this.props.dish; | ||
|
||
if(dish == null) | ||
return( | ||
<div> | ||
|
||
</div> | ||
) | ||
const dishItem= this.renderDish(dish); | ||
const comment = this.renderComment(dish.comments); | ||
return( | ||
<div className="row"> | ||
{dishItem} | ||
{comment} | ||
</div> | ||
) | ||
} | ||
|
||
} | ||
|
||
export default DishDetail; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,50 @@ | ||
import React from 'react'; | ||
import {Card, CardImg, CardImgOverlay, CardText, CardBody, CardTitle} from 'reactstrap'; | ||
import { Card, CardImg, CardImgOverlay, CardTitle } from 'reactstrap'; | ||
import Dishdetail from './DishDetail' | ||
import { DISHES } from '../shared/dishes'; | ||
|
||
|
||
class Menu extends React.Component { | ||
|
||
constructor(props) { | ||
class Menu extends React.Component{ | ||
constructor(props) | ||
{ | ||
super(props); | ||
|
||
this.state = { | ||
this.state={ | ||
selectedDish: null | ||
} | ||
} | ||
|
||
onDishSelect(dish) { | ||
this.setState({ selectedDish: dish}); | ||
onSelectedDish(dish) | ||
{ | ||
this.setState({ | ||
selectedDish: dish | ||
}) | ||
} | ||
|
||
|
||
renderDish(dish) { | ||
if (dish != null) | ||
return( | ||
<Card> | ||
<CardImg top src={dish.image} alt={dish.name} /> | ||
<CardBody> | ||
<CardTitle>{dish.name}</CardTitle> | ||
<CardText>{dish.description}</CardText> | ||
</CardBody> | ||
</Card> | ||
); | ||
else | ||
return( | ||
<div></div> | ||
); | ||
} | ||
|
||
render() { | ||
const menu = this.props.dishes.map((dish) => { | ||
render(){ | ||
|
||
|
||
const menu = this.props.dishes.map(dish => { | ||
return ( | ||
<div className="col-12 col-md-5 m-1"> | ||
<Card key={dish.id} | ||
onClick={() => this.onDishSelect(dish)}> | ||
<CardImg width="100%" src={dish.image} alt={dish.name} /> | ||
<CardImgOverlay> | ||
<CardTitle>{dish.name}</CardTitle> | ||
</CardImgOverlay> | ||
</Card> | ||
</div> | ||
<div key={dish.id} className='col-12 col-md-5 m-1'> | ||
<Card onClick={() => this.onSelectedDish(dish)} > | ||
<CardImg width="100%" src={dish.image} alt={dish.name} /> | ||
<CardImgOverlay> | ||
<CardTitle >{dish.name}</CardTitle> | ||
</CardImgOverlay> | ||
</Card> | ||
</div> | ||
); | ||
}); | ||
|
||
return ( | ||
<div className="container"> | ||
<div className="row"> | ||
{menu} | ||
</div> | ||
<div className="row"> | ||
<div className="col-12 col-md-5 m-1"> | ||
{this.renderDish(this.state.selectedDish)} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
return( | ||
<div className="container"> | ||
<div className="row"> | ||
{menu} | ||
</div> | ||
<Dishdetail dish={this.state.selectedDish}></Dishdetail> | ||
</div> | ||
) | ||
|
||
} | ||
} | ||
|
||
export default Menu; | ||
export default Menu; |