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