@@ -45,6 +45,8 @@ const reactionVariant = {
4545 } ,
4646} ;
4747
48+ const navStyles = { position : 'fixed' , width : '83%' , top : '0' , zIndex :1 , background : '#fff' , marginTop : '0px' , marginBottom :'0px' }
49+
4850const CustomToggle = React . forwardRef ( ( { children, onClick } , ref ) => (
4951 < a
5052 href = ""
@@ -130,6 +132,7 @@ function NewsFeed(props) {
130132 const [ projects , setAllProjects ] = useState ( [ ] ) ;
131133 const [ posts , setAllPosts ] = useState ( [ ] ) ;
132134 const [ votes , setVotes ] = useState ( { } ) ;
135+ const [ isTop , setisTop ] = useState ( false ) ;
133136 const [ displayReactionContainer , setDisplayReactioContainer ] = useState (
134137 false
135138 ) ;
@@ -141,6 +144,13 @@ function NewsFeed(props) {
141144 setAllPosts ( props ?. allPosts ) ;
142145 } , [ props . allEvents , props . allPosts , props . allProjects , props ] ) ;
143146
147+ useEffect ( ( ) => {
148+ window . addEventListener ( "scroll" , ( ) => {
149+ const scrollAmount = window . scrollY ;
150+ scrollAmount > 369 ? setisTop ( true ) : setisTop ( false )
151+ } ) ;
152+ } , [ window ] ) ;
153+
144154 let navigateToProfile = ( userId ) => {
145155 console . log ( `Navigating to user profile ${ userId } ` ) ;
146156 props . history . push ( `/profile/${ userId } ` ) ;
@@ -541,58 +551,9 @@ function NewsFeed(props) {
541551 </ div >
542552 </ div >
543553 < div className = "news__feed__container" >
544- { /* <div className="posts">
545- <span className="category">
546- <span className="to-centre">
547- {first === "f" ? (
548- <Button
549- active
550- variant="primary"
551- className="category-btn"
552- onClick={handleClick("All")}
553- >
554- <span className="btn-content">All</span>
555- </Button>
556- ) : (
557- <Button
558- autoFocus
559- variant="primary"
560- className="category-btn"
561- onClick={handleClick("All")}
562- >
563- All
564- </Button>
565- )}
566- <span className="space"></span>
567- <Button
568- variant="primary"
569- className="category-btn"
570- onClick={handleClick("Post")}
571- >
572- <span className="btn-content">Posts</span>
573- </Button>
574- <span className="space"></span>
575- <Button
576- variant="primary"
577- className="category-btn"
578- onClick={handleClick("Event")}
579- >
580- <span className="btn-content">Events</span>
581- </Button>
582- <span className="space"></span>
583- <Button
584- variant="primary"
585- className="category-btn"
586- onClick={handleClick("Project")}
587- >
588- <span className="btn-content">Projects</span>
589- </Button>
590- </span>
591- </span>
592- </div> */ }
593- < div className = "tabs__container" >
554+ < div className = "tabs__container" style = { isTop ? navStyles : { } } >
594555 < span className = "nav__tab container" >
595- < ul className = "nav__list__container" >
556+ < ul className = "nav__list__container" style = { isTop ? { marginBottom : '0px' } : { } } >
596557 < li
597558 className = {
598559 type === "All"
0 commit comments