@@ -3,7 +3,7 @@ import { useSelector } from 'react-redux';
3
3
import Modal from 'react-modal' ;
4
4
// withRouter is a higher-order component
5
5
// ( A function which takes component as input and return modified component as output )
6
- import { withRouter } from 'react-router-dom' ;
6
+ import { Link , withRouter } from 'react-router-dom' ;
7
7
import { selectUser } from '../../features/userSlice' ;
8
8
import db , { auth } from '../../firebase' ;
9
9
import firebase from 'firebase' ;
@@ -17,46 +17,58 @@ Modal.setAppElement("#root");
17
17
18
18
const Navbar = ( { history, match} ) => {
19
19
20
- const user = useSelector ( selectUser ) ;
21
- const [ openModal , setopenModal ] = useState ( false ) ;
22
- const [ selectOption , setSelectOption ] = useState ( ) ;
23
- const [ input , setInput ] = useState ( "" ) ;
24
- const [ inputUrl , setInputUrl ] = useState ( "" ) ;
20
+ const user = useSelector ( selectUser ) ;
21
+ const [ openModal , setopenModal ] = useState ( false ) ;
22
+ const [ selectOption , setSelectOption ] = useState ( ) ;
23
+ const [ input , setInput ] = useState ( "" ) ;
24
+ const [ inputUrl , setInputUrl ] = useState ( "" ) ;
25
25
26
- const handleChange = ( e ) => {
27
- setSelectOption ( e . target . value ) ;
28
- }
26
+ const handleChange = ( e ) => {
27
+ setSelectOption ( e . target . value ) ;
28
+ }
29
29
30
- const handleQuestion = ( e ) => {
31
- e . preventDefault ( ) ;
32
- setopenModal ( false ) ;
33
- db . collection ( 'questions' ) . add ( {
34
- section :selectOption ,
35
- question :input ,
36
- imageUrl :inputUrl ,
37
- timestamp :firebase . firestore . FieldValue . serverTimestamp ( ) ,
38
- user : user ,
39
- } ) ;
40
- setInput ( "" ) ;
41
- setInputUrl ( "" ) ;
42
- setSelectOption ( "" ) ;
43
- }
30
+ const handleQuestion = ( e ) => {
31
+ e . preventDefault ( ) ;
32
+ setopenModal ( false ) ;
33
+ db . collection ( 'questions' ) . add ( {
34
+ section :selectOption ,
35
+ question :input ,
36
+ imageUrl :inputUrl ,
37
+ timestamp :firebase . firestore . FieldValue . serverTimestamp ( ) ,
38
+ user : user ,
39
+ } ) ;
40
+ setInput ( "" ) ;
41
+ setInputUrl ( "" ) ;
42
+ setSelectOption ( "" ) ;
43
+ }
44
+
45
+ const navStyle = {
46
+ listStyle : 'none' ,
47
+ textDecoration : 'none' ,
48
+ } ;
44
49
45
50
return (
46
51
< div className = "navbar" >
47
52
< div className = "header_logo" >
48
53
< img src = { logo } alt = "JU" />
49
54
</ div >
50
55
< div className = "icons_wrapper" >
51
- < div className = "icon" >
52
- < HomeIcon />
53
- </ div >
54
- < div className = "icon" onClick = { ( ) => history . push ( `${ match . url } /following` ) } >
55
- < FeaturedPlayListOutlined />
56
- </ div >
57
- < div className = "icon" >
58
- < AssignmentTurnedInOutlined />
59
- </ div >
56
+ < Link to = "/" style = { navStyle } >
57
+ < div className = "icon" >
58
+ < HomeIcon />
59
+ </ div >
60
+ </ Link >
61
+ { /* <div className="icon" onClick={() => history.push(`${match.url}/following`) }> */ }
62
+ < Link to = "/following" style = { navStyle } >
63
+ < div className = "icon" >
64
+ < FeaturedPlayListOutlined />
65
+ </ div >
66
+ </ Link >
67
+ < Link to = "/question" style = { navStyle } >
68
+ < div className = "icon" >
69
+ < AssignmentTurnedInOutlined />
70
+ </ div >
71
+ </ Link >
60
72
< div className = "icon" >
61
73
< PeopleAltOutlined />
62
74
</ div >
0 commit comments