diff --git a/client/src/components/App/index.js b/client/src/components/App/index.js
index fb40f2a..f0b38e2 100644
--- a/client/src/components/App/index.js
+++ b/client/src/components/App/index.js
@@ -8,7 +8,7 @@ export default () => {
return (
-
+
diff --git a/client/src/components/MealPage/Category.js b/client/src/components/MealPage/Category.js
index f53a835..aa1c410 100644
--- a/client/src/components/MealPage/Category.js
+++ b/client/src/components/MealPage/Category.js
@@ -10,7 +10,7 @@ const Category = ({ fetchMeals }) => {
fetchMeals('Desserts')}
+ onClick={() => fetchMeals('desserts')}
role="button"
onKeyPress={key => key}
>
@@ -21,7 +21,7 @@ const Category = ({ fetchMeals }) => {
fetchMeals('Breakfast')}
+ onClick={() => fetchMeals('breakfast')}
role="button"
onKeyPress={key => key}
>
@@ -32,7 +32,7 @@ const Category = ({ fetchMeals }) => {
fetchMeals('Drinks')}
+ onClick={() => fetchMeals('drinks')}
role="button"
onKeyPress={key => key}
>
@@ -43,18 +43,18 @@ const Category = ({ fetchMeals }) => {
fetchMeals('Sandwishes')}
+ onClick={() => fetchMeals('sandwishes')}
role="button"
onKeyPress={key => key}
>
- Sandwishes
+ Sandwiches
fetchMeals('Main')}
+ onClick={() => fetchMeals('main')}
role="button"
onKeyPress={key => key}
>
diff --git a/client/src/components/MealPage/MealList.js b/client/src/components/MealPage/MealList.js
index b6ff1e9..3cd3f74 100644
--- a/client/src/components/MealPage/MealList.js
+++ b/client/src/components/MealPage/MealList.js
@@ -4,6 +4,8 @@ import CardMeal from './CardMeal';
import './style.css';
const MealList = ({ data }) => {
+ console.log(data);
+
const listItems = data.map(item => {
return (
diff --git a/client/src/components/MealPage/index.js b/client/src/components/MealPage/index.js
index d7367a5..63b77f5 100644
--- a/client/src/components/MealPage/index.js
+++ b/client/src/components/MealPage/index.js
@@ -10,19 +10,18 @@ import './style.css';
class MenuPage extends React.Component {
state = {
showMenu: true,
- category: 'main',
data: [],
};
componentDidMount() {
- const { category } = this.state;
- this.fetchMeals(category);
+ this.fetchMeals('main');
}
- fetchMeals = category => {
+ fetchMeals = (cat = 'main') => {
const { history } = this.props;
- this.setState({ category });
- fetch(`/api/v1/meals?category=${category}`)
+ history.push(`/meals?category=${cat}`);
+
+ fetch(`/api/v1/meals?category=${cat}`)
.then(res => res.json())
.then(result => {
this.setState({
@@ -54,7 +53,11 @@ class MenuPage extends React.Component {
};
Header = () => {
- const { category } = this.state;
+ const {
+ location: { search },
+ } = this.props;
+ const paramVal = new URLSearchParams(search);
+ const category = paramVal.get('category');
return (
@@ -98,5 +101,7 @@ class MenuPage extends React.Component {
}
MenuPage.propTypes = {
history: PropTypes.objectOf(PropTypes.any).isRequired,
+ location: PropTypes.objectOf(PropTypes.any).isRequired,
};
+
export default MenuPage;
diff --git a/client/src/components/MealPage/style.css b/client/src/components/MealPage/style.css
index 94463f6..b9eb798 100644
--- a/client/src/components/MealPage/style.css
+++ b/client/src/components/MealPage/style.css
@@ -8,7 +8,9 @@
border-radius: 8px;
align-items: center;
}
-
+.categoryName{
+ text-transform: capitalize;
+}
.categoryList{
width: 100%;
height: 99vh;