1.1.4 • Published 6 years ago
off-viewpoint-layout v1.1.4
Off viewpoint layout
a off viewpoint layout
- add reducer to reducers/index.js
import {MenuReducer} from 'off-viewpoint-layout';
...
const rootReducer = combineReducers({
menu: MenuReducer,
...
});
- add action creator to a component
- add toggleMenu action to onClick event
- add className="side-menu" to menu
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {OffViewpointLayout, RightSideMenu, toggleMenu} from 'off-viewpoint-layout';
class SampleComponent extends Component {
render() {
return (
<div id="sample">
<OffViewpointLayout>
<div onClick={() => this.props.toggleMenu()}>MAIN AREA</div>
<RightSideMenu>
<ul>
<li>menu item 1</li>
<li>menu item 2</li>
<li>menu item 3</li>
<li>menu item 4</li>
</ul>
</RightSideMenu>
</OffViewpointLayout>
</div>
);
}
}
function mapStateToProps(state) {
return {};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators({
toggleMenu
}, dispatch);
}
export default connect(mapStateToProps, mapDispatchToProps)(SampleComponent);
1.1.4
6 years ago
1.1.3
6 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.3
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago
0.0.12
6 years ago
0.0.11
6 years ago
0.0.10
6 years ago
0.0.9
6 years ago
0.0.8
6 years ago
0.0.7
6 years ago
0.0.6
6 years ago
0.0.5
6 years ago
0.0.4
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago