Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save paigen11/84e176963619abbe65d6a4666145e2bb to your computer and use it in GitHub Desktop.
Save paigen11/84e176963619abbe65d6a4666145e2bb to your computer and use it in GitHub Desktop.
The sidebar navlinks rendered by React Socks when the viewport is mobile sized or smaller.
const Sidebar = () => {
const [expandedLinks, setExpandedLinks] = useState(false);
const toggleLinks = () => () => {
setExpandedLinks(!expandedLinks);
};
return (
<>
<ul className="sidebar-top">
<div className="sidebar-links">
<li className="sidebar-link bars" onClick={toggleLinks()}>
<i className="fa fa-bars" aria-hidden="true" />
</li>
<li
className="sidebar-link-logo"
onClick={() => setExpandedLinks(false)}
>
<NavLink to="/">
<img src={TmdbIcon} alt="logo" />
</NavLink>
</li>
</div>
</ul>
<div>
<li className="sidebar-link" onClick={() => setExpandedLinks(false)}>
<NavLink to="/nowplaying">Now Playing</NavLink>
</li>
<li className="sidebar-link" onClick={() => setExpandedLinks(false)}>
<NavLink to="/upcoming">Coming Soon</NavLink>
</li>
<li className="sidebar-link" onClick={() => setExpandedLinks(false)}>
<NavLink to="/search">Movie Search</NavLink>
</li>
<li className="sidebar-link" onClick={() => setExpandedLinks(false)}>
<NavLink to="/genres">Genres</NavLink>
</li>
</div>
</>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment