import React from 'react' import { Menu } from 'react-feather' import { timingSafeEqual } from 'crypto' interface Props { height?: number } interface States { scrolled: boolean } export default class Navbar extends React.Component { private height = 80 private menuRef = undefined constructor(props: Props) { super(props) if (this.props.height) { this.height = this.props.height } } setRef = element => { this.menuRef = element } onScroll = () => { this.setState({ scrolled: window.pageYOffset > 207 }) } componentDidMount() { window.addEventListener('scroll', this.onScroll) } componentWillUnmount() { window.removeEventListener('scroll', this.onScroll) } onClick = () => { this.menuRef.classList.toggle("shown") } render() { const height = this.props.height || 80 // if (!this.state.scrolled) // console.log(this.state.scrolled) return ( ) } }