Skip to content

Instantly share code, notes, and snippets.

@charlintosh
Created May 6, 2021 15:21
Show Gist options
  • Save charlintosh/269c13708d998143f1bd8b5b5f38106e to your computer and use it in GitHub Desktop.
Save charlintosh/269c13708d998143f1bd8b5b5f38106e to your computer and use it in GitHub Desktop.
import * as React from "react";
import "./Nav.component.scss";
import {useObservable} from "rxjs-hooks";
import {watchScroll$} from "./nav.service";
import {ScrollMovement, ScrollType} from "./types";
// other imports
function Nav(): JSX.Element {
const scrollDirection: ScrollType = useObservable(watchScroll$, ScrollMovement.UP);
return (
<div className={cn("Nav", {"hidden": scrollDirection === ScrollMovement.DOWN})}>
<div className="Nav__Item">
<a className="Logo" href="/">
<img src={Logo} alt="Carlos Gómez"/>
</a>
</div>
<div className="Nav__Item">
<Menu/>
</div>
</div>
);
}
export default Nav;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment