Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. class App extends Component {
  2.  
  3. state = { fixed: false }
  4.  
  5. componentDidMount() {
  6. window.addEventListener('scroll', this.handleScroll);
  7. }
  8.  
  9. componentWillUnmount() {
  10. window.removeEventListener('scroll', this.handleScroll);
  11. }
  12.  
  13. handleScroll(e) {
  14. let scrollTop = e.srcElement.body.scrollTop;
  15. (scrollTop > 0) ? this.setState({ fixed: true }) : this.setState({ fixed: false });
  16. }
  17.  
  18. render() {
  19. // grab steps
  20. const { steps } = this.props;
  21. const { fixed } = this.state;
  22. const { scrollToStep } = this;
  23.  
  24. return ce('div', { className:'allTheSteps' },
  25. ce(pagination, { steps, fixed }),
  26. Object.values(steps).map((step, i) =>
  27. ce(Steps, { step, key: v4(), i }),
  28. )
  29. );
  30. };
  31.  
  32. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement