summaryrefslogtreecommitdiff
path: root/src/components/top-nav/index.js
blob: 365e481318f08de212a05b70675e5541a3664a7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Link } from 'react-router-dom';

import './styles.css';
import Logo from '../icons/logo';

const TopNav = (props) => (
  <div className='top-nav'>
    <div className="container clearfix">
      <Link to="/" className="logo clearfix float-left">
        <Logo/>
        <div className="logo-text">
          <h4>GitHunt</h4>
          <p className="text-muted">Most starred projects on GitHub</p>
        </div>
      </Link>
      <div className="float-right duration-btns">
        <button onClick={ () => props.updateDateJump('year') }
                className={
                  classNames('btn', {
                    'btn-primary': props.selectedDateJump === 'year',
                    'btn-light': props.selectedDateJump !== 'year',
                  })
                }>
          Yearly
        </button>
        <button onClick={ () => props.updateDateJump('month') }
                className={
                  classNames('btn', {
                    'btn-primary': props.selectedDateJump === 'month',
                    'btn-light': props.selectedDateJump !== 'month',
                  })
                }>
          Monthly
        </button>
        <button onClick={ () => props.updateDateJump('week') }
                className={
                  classNames('btn', {
                    'btn-primary': props.selectedDateJump === 'week',
                    'btn-light': props.selectedDateJump !== 'week',
                  })
                }>
          Weekly
        </button>
        <button onClick={ () => props.updateDateJump('day') }
                className={
                  classNames('btn', {
                    'btn-primary': props.selectedDateJump === 'day',
                    'btn-light': props.selectedDateJump !== 'day',
                  })
                }>
          Daily
        </button>
      </div>
    </div>
  </div>
);

TopNav.propTypes = {
  updateDateJump: PropTypes.func.isRequired,
  selectedDateJump: PropTypes.string
};

export default TopNav;