This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
63 lines (59 loc) · 1.66 KB
/
index.js
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
import React from 'react';
import { Link } from 'react-router-dom';
import { DISPLAY_TYPE } from '../../containers/navbar/DisplayTypes';
import { BUTTON_TYPE } from '../../containers/navbar/ButtonTypes';
import { SecondaryButton } from '../input/buttons';
const getLogo = () => (
<Link to="/"><img alt="" src="../../assets/logo.png" /></Link>
);
const getButton = (buttonType) => {
switch (buttonType) {
case BUTTON_TYPE.SIGN_IN:
return (<Link to="/login"><SecondaryButton text="Sign in" /></Link>);
case BUTTON_TYPE.SIGN_OUT:
return (<Link to="/logout"><SecondaryButton text="Sign out" /></Link>);
case BUTTON_TYPE.DASHBOARD:
return (<Link to="/dashboard"><SecondaryButton text="My application" /></Link>);
default:
return (<div />);
}
};
const Navbar = ({ displayType, buttonType }) => {
switch (displayType) {
case DISPLAY_TYPE.ONLY_LOGO:
return (
<nav>
<div>
<div>{getLogo()}</div>
</div>
</nav>
);
case DISPLAY_TYPE.LOGO_AND_BUTTON:
return (
<nav>
<div>
<div>{getLogo()}</div>
</div>
<div>
<div>{getButton(buttonType)}</div>
</div>
</nav>
);
default:
return (
<nav>
<div>
<div>{getLogo()}</div>
</div>
<div>
<div><Link to="/">About</Link></div>
<div><Link to="/">FAQ</Link></div>
<div><Link to="/">Sponsors</Link></div>
<div><Link to="/">2018</Link></div>
<div>{getButton(buttonType)}</div>
</div>
</nav>
);
}
};
export default Navbar;