From 942f9fd1131570b36020791caffbce00896384f5 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Wed, 29 Aug 2018 16:46:38 +0500 Subject: Handle same date jumps --- src/components/top-nav/index.js | 110 ++++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 49 deletions(-) (limited to 'src/components') diff --git a/src/components/top-nav/index.js b/src/components/top-nav/index.js index 365e481..50f7e86 100644 --- a/src/components/top-nav/index.js +++ b/src/components/top-nav/index.js @@ -6,57 +6,69 @@ import { Link } from 'react-router-dom'; import './styles.css'; import Logo from '../icons/logo'; -const TopNav = (props) => ( -
-
- - -
-

GitHunt

-

Most starred projects on GitHub

+class TopNav extends React.Component { + updateDateJump = (dateJump) => { + if (dateJump === this.props.selectedDateJump) { + return; + } + + this.props.updateDateJump(dateJump); + }; + + render() { + return ( +
+
+ + +
+

GitHunt

+

Most starred projects on GitHub

+
+ +
+ + + + +
- -
- - - -
-
-
-); + ); + } +} TopNav.propTypes = { updateDateJump: PropTypes.func.isRequired, -- cgit v1.3