CategoryPresenter.js
1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import React from "react";
import styled from "styled-components";
import { Link } from "react-router-dom";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faArrowDown, faPlus } from "@fortawesome/free-solid-svg-icons";
const CategoryContainer = styled.div`
display: flex;
justify-content: center;
align-items: center;
svg {
font-size: 20px;
}
span {
margin-left: 10px;
font-size: 20px;
}
border-top: 1px solid rgba(255, 255, 255, 0.5);
`;
const ItemListContainer = styled.div`
display: flex;
flex-direction: row;
width: 100%;
padding: 15px;
`;
const ItemList = styled.ul`
align-items: center;
svg {
margin: 0px 10px;
}
`;
const ItemListTopBox = styled.div`
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
margin-bottom: 10px;
`;
const Item = styled.li``;
const ItemText = styled.span`
font-family: "Ubuntu", sans-serif;
`;
const StyledLink = styled(Link)`
width: 100%;
display: flex;
flex-direction: row;
justify-content: left;
align-items: center;
text-decoration: none;
color: white;
padding-left: 10px;
cursor: pointer;
&:hover {
background-color: white;
color: #667aff;
}
`;
export default ({ location, categories }) => {
const { pathname } = location;
let path;
return (
<>
<CategoryContainer>
<ItemListContainer>
<ItemList>
<ItemListTopBox>
<FontAwesomeIcon icon={faArrowDown} /> Category
<FontAwesomeIcon icon={faPlus} />
</ItemListTopBox>
{categories &&
categories.map((e) =>
(path = pathname + "/:" + e.name)(
<StyledLink to={path} key={e.id}>
<Item>
<ItemText># {e.name}</ItemText>
</Item>
</StyledLink>
)
)}
</ItemList>
</ItemListContainer>
</CategoryContainer>
</>
);
};