diff --git a/src/features/common/SidePanel.js b/src/features/common/SidePanel.js new file mode 100644 index 0000000..690f599 --- /dev/null +++ b/src/features/common/SidePanel.js @@ -0,0 +1,51 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { bindActionCreators } from 'redux'; +import { connect } from 'react-redux'; +import { NavLink } from 'react-router-dom'; +import matrixLogo from '../../images/matrix-logo.svg'; +import * as actions from './redux/actions'; + +export class SidePanel extends Component { + static propTypes = { + common: PropTypes.object.isRequired, + actions: PropTypes.object.isRequired, + }; + + render() { + return ( +
+
+ logo +
+ +
+ ); + } +} + +/* istanbul ignore next */ +function mapStateToProps(state) { + return { + common: state.common, + }; +} + +/* istanbul ignore next */ +function mapDispatchToProps(dispatch) { + return { + actions: bindActionCreators({ ...actions }, dispatch), + }; +} + +export default connect( + mapStateToProps, + mapDispatchToProps, +)(SidePanel); diff --git a/src/features/common/SidePanel.scss b/src/features/common/SidePanel.scss new file mode 100644 index 0000000..1275b08 --- /dev/null +++ b/src/features/common/SidePanel.scss @@ -0,0 +1,37 @@ +@import '../../styles/mixins'; + +.common-side-panel { + position: fixed; + box-sizing: border-box; + overflow: auto; + top: 0; + left: 0; + margin: 0; + width: 260px; + height: 100%; + background-color: #EEE; + + .app-logo { + margin: 30px; + width: 200px; + } + + ul, + li { + padding: 0; + margin: 0; + list-style: none; + } + + a { + display: block; + padding: 8px; + padding-left: 24px; + text-decoration: none; + color: black; + } + a.active { + font-weight: bold; + background-color: #CCC; + } +} diff --git a/src/features/common/index.js b/src/features/common/index.js index 6d93a51..279d9c7 100644 --- a/src/features/common/index.js +++ b/src/features/common/index.js @@ -1 +1,2 @@ export { default as PageNotFound } from './PageNotFound'; +export { default as SidePanel } from './SidePanel'; diff --git a/src/features/common/style.scss b/src/features/common/style.scss index c89b4a5..eff28a4 100644 --- a/src/features/common/style.scss +++ b/src/features/common/style.scss @@ -1 +1,2 @@ @import '../../styles/mixins'; +@import './SidePanel'; diff --git a/tests/features/common/SidePanel.test.js b/tests/features/common/SidePanel.test.js new file mode 100644 index 0000000..39722f3 --- /dev/null +++ b/tests/features/common/SidePanel.test.js @@ -0,0 +1,19 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import { SidePanel } from '../../../src/features/common/SidePanel'; + +describe('common/SidePanel', () => { + it('renders node with correct class name', () => { + const props = { + common: {}, + actions: {}, + }; + const renderedComponent = shallow( + + ); + + expect( + renderedComponent.find('.common-side-panel').length + ).toBe(1); + }); +});