categoryListPage

This commit is contained in:
Ruidy Nemausat 2020-01-25 21:14:12 +01:00
parent 02648a37b7
commit 87449cf3c5
4 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,23 @@
import React from "react";
import { Link } from "react-router-dom";
const CategoryEntry = props => {
const {
strCategory,
strCategoryThumb,
strCategoryDescription
} = props.category;
const url = `/${strCategory}`;
return (
<Link to={url}>
<div className="row">
<li key={props.key}>
<img src={strCategoryThumb} alt={strCategory} />
<h3>{strCategory}</h3> {strCategoryDescription}
</li>
</div>
</Link>
);
};
export default CategoryEntry;

BIN
src/images/parallax1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 MiB

BIN
src/images/parallax2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 KiB

25
src/pages/CategoryList.js Normal file
View file

@ -0,0 +1,25 @@
import React from "react";
import CategoryEntry from "../components/CategoryEntry";
const CategoryListPage = props => {
// const { categories } = props;
const categories = props.categories.categories;
// if (categories.length > 0) {
// }
// const { strCategory } = categories;
return (
<div className="section">
<div className="container">
<h1>The Chef's meal categories</h1>
<ul>
{categories.map((category, i) => (
<CategoryEntry key={i} category={category} />
))}
</ul>
</div>
</div>
);
};
export default CategoryListPage;