Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class App extends Component {
- state = { fixed: false }
- componentDidMount() {
- window.addEventListener('scroll', this.handleScroll);
- }
- componentWillUnmount() {
- window.removeEventListener('scroll', this.handleScroll);
- }
- handleScroll(e) {
- let scrollTop = e.srcElement.body.scrollTop;
- (scrollTop > 0) ? this.setState({ fixed: true }) : this.setState({ fixed: false });
- }
- render() {
- // grab steps
- const { steps } = this.props;
- const { fixed } = this.state;
- const { scrollToStep } = this;
- return ce('div', { className:'allTheSteps' },
- ce(pagination, { steps, fixed }),
- Object.values(steps).map((step, i) =>
- ce(Steps, { step, key: v4(), i }),
- )
- );
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement