11import React from 'react'
22import R from 'ramda'
3+ import { Waypoint } from 'react-waypoint'
34import { SortableContainer , SortableElement } from 'react-sortable-hoc'
4-
55import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'
66
77import MenuBar from './MenuBar'
8+ import { scrollOnTop , scrollOffTop } from './logic'
89import { Wrapper , ScrollWrapper } from './styles/menu_list'
910
1011const SortableMenuBar = SortableElement (
@@ -19,30 +20,39 @@ const SortableMenuBar = SortableElement(
1920)
2021
2122const MenuList = SortableContainer (
22- ( { items, pin, activeRaw, forceRerender } ) => {
23+ ( { items, pin, activeRaw, forceRerender, showHomeBarShadow } ) => {
2324 const homeCommunities = R . filter ( R . propEq ( 'raw' , 'home' ) , items )
2425 const sortableCommunities = R . reject ( R . propEq ( 'raw' , 'home' ) , items )
2526
2627 return (
2728 < Wrapper >
2829 { homeCommunities . map ( item => (
29- < MenuBar key = { item . raw } pin = { pin } item = { item } activeRaw = { activeRaw } />
30+ < MenuBar
31+ key = { item . raw }
32+ pin = { pin }
33+ item = { item }
34+ activeRaw = { activeRaw }
35+ dropShadow = { showHomeBarShadow }
36+ />
3037 ) ) }
3138 < OverlayScrollbarsComponent
3239 options = { { scrollbars : { autoHide : 'scroll' , autoHideDelay : 200 } } }
3340 className = "os-theme-light"
3441 >
3542 < ScrollWrapper >
36- { sortableCommunities . map ( ( item , index ) => (
37- < SortableMenuBar
38- index = { index }
39- key = { item . raw }
40- pin = { pin }
41- item = { item }
42- activeRaw = { activeRaw }
43- forceRerender = { forceRerender }
44- />
45- ) ) }
43+ < React . Fragment >
44+ < Waypoint onEnter = { scrollOnTop } onLeave = { scrollOffTop } />
45+ { sortableCommunities . map ( ( item , index ) => (
46+ < SortableMenuBar
47+ index = { index }
48+ key = { item . raw }
49+ pin = { pin }
50+ item = { item }
51+ activeRaw = { activeRaw }
52+ forceRerender = { forceRerender }
53+ />
54+ ) ) }
55+ </ React . Fragment >
4656 </ ScrollWrapper >
4757 </ OverlayScrollbarsComponent >
4858 </ Wrapper >
0 commit comments