Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. import React from "react";
  2.  
  3. import * as PersonActions from "../Flux/Actions/PersonActions";
  4.  
  5. import Sidebar from "react-sidebar";
  6. import SidebarContent from "./SidebarContent";
  7. import CustomNavbar from "./CustomNavbar";
  8.  
  9. export default class Layout extends React.Component {
  10.  
  11. constructor(props) {
  12. super(props);
  13. this.state = {
  14.  
  15. //User state
  16. person: PersonActions.loadPerson(),
  17.  
  18. //Sidebar states
  19. docked: false,
  20. open: false,
  21. transitions: true,
  22. touch: true,
  23. shadow: true,
  24. pullRight: false,
  25. touchHandleWidth: 20,
  26. dragToggleDistance: 30
  27.  
  28. };
  29. }
  30.  
  31. onSetDocked(docked) {
  32. this.setState({docked: docked});
  33. }
  34.  
  35. menuButtonClick(ev) {
  36. ev.preventDefault();
  37. this.onSetDocked(!this.state.docked);
  38. }
  39.  
  40. render() {
  41. const sidebarContent = <SidebarContent onClick={this.menuButtonClick.bind(this)}/>;
  42. return (
  43. <Sidebar
  44. sidebar={sidebarContent}
  45. open={this.state.open}
  46. docked={this.state.docked}
  47. onSetDocked={this.onSetDocked.bind(this)}
  48. >
  49. <CustomNavbar onClick={this.menuButtonClick.bind(this)}/>
  50. <div className="content">
  51. {this.props.children}
  52. </div>
  53. </Sidebar>
  54. );
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement