mirror of
https://github.com/rjNemo/meal_planner
synced 2026-06-06 02:26:49 +00:00
categoryListPage
This commit is contained in:
parent
02648a37b7
commit
87449cf3c5
4 changed files with 48 additions and 0 deletions
23
src/components/CategoryEntry.js
Normal file
23
src/components/CategoryEntry.js
Normal 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
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
BIN
src/images/parallax2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 556 KiB |
25
src/pages/CategoryList.js
Normal file
25
src/pages/CategoryList.js
Normal 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;
|
||||
Loading…
Reference in a new issue