Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 56 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import React from 'react'; |
||
2 | import PropTypes from 'prop-types'; |
||
3 | import styled from 'styled-components'; |
||
4 | |||
5 | import BasicButton from 'components/elements/basic-button'; |
||
6 | |||
7 | export class SideNav extends React.PureComponent { |
||
8 | static propTypes = { |
||
9 | className: PropTypes.string, |
||
10 | func: PropTypes.func, |
||
11 | list: PropTypes.arrayOf( |
||
12 | PropTypes.shape({ |
||
13 | id: PropTypes.string, |
||
14 | value: PropTypes.string, |
||
15 | }), |
||
16 | ), |
||
17 | }; |
||
18 | |||
19 | static defaultProps = {}; |
||
20 | |||
21 | render() { |
||
22 | const { className, list } = this.props; |
||
23 | const { func } = this.props; |
||
24 | return ( |
||
25 | <ul className={className}> |
||
26 | {list.map(item => ( |
||
27 | <li key={item.id}> |
||
28 | <BasicButton |
||
29 | className="navButton" |
||
30 | func={() => func(item.id)} |
||
31 | text={item.value} |
||
32 | /> |
||
33 | </li> |
||
34 | ))} |
||
35 | </ul> |
||
36 | ); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | export default styled(SideNav)` |
||
41 | list-style-type: none; |
||
42 | padding: 0; |
||
43 | width: 160px; |
||
44 | |||
45 | .navButton { |
||
46 | background: none; |
||
47 | color: grey; |
||
48 | text-align: left; |
||
49 | |||
50 | &:hover { |
||
51 | text-decoration: underline; |
||
52 | color: black; |
||
53 | } |
||
54 | } |
||
55 | `; |
||
56 |