Last change
on this file since a2e5735 was a2e5735, checked in by Nace Gjorgjievski <nace.gorgievski123@…>, 23 months ago |
Final Version
|
-
Property mode
set to
100644
|
File size:
696 bytes
|
Line | |
---|
1 | import React from "react";
|
---|
2 | import { Link } from "react-router-dom";
|
---|
3 | import SubCategoryMenu from "./SubCategoryMenu";
|
---|
4 |
|
---|
5 | function CategoryMenu(props) {
|
---|
6 | let ul = document.getElementById("subCategoryList");
|
---|
7 |
|
---|
8 | const result = [];
|
---|
9 |
|
---|
10 | props.category.subCategories.forEach((sub) => {
|
---|
11 | result.push(
|
---|
12 | <SubCategoryMenu
|
---|
13 | subCategory={sub}
|
---|
14 | category={props.category}
|
---|
15 | ></SubCategoryMenu>
|
---|
16 | );
|
---|
17 | });
|
---|
18 |
|
---|
19 | const categoryUrl = `/products/${props.category.categorySlug}/all`;
|
---|
20 | return (
|
---|
21 | <div>
|
---|
22 | <Link to={categoryUrl}>
|
---|
23 | <span>{props.category.categoryName}</span>
|
---|
24 | </Link>
|
---|
25 | <ul id="subCategoryList">{result}</ul>
|
---|
26 | </div>
|
---|
27 | );
|
---|
28 | }
|
---|
29 |
|
---|
30 | export default CategoryMenu;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.