1
1
import React from 'react'
2
2
import R from 'ramda'
3
+ import { Waypoint } from 'react-waypoint'
3
4
import { SortableContainer , SortableElement } from 'react-sortable-hoc'
4
-
5
5
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'
6
6
7
7
import MenuBar from './MenuBar'
8
+ import { scrollOnTop , scrollOffTop } from './logic'
8
9
import { Wrapper , ScrollWrapper } from './styles/menu_list'
9
10
10
11
const SortableMenuBar = SortableElement (
@@ -19,30 +20,39 @@ const SortableMenuBar = SortableElement(
19
20
)
20
21
21
22
const MenuList = SortableContainer (
22
- ( { items, pin, activeRaw, forceRerender } ) => {
23
+ ( { items, pin, activeRaw, forceRerender, showHomeBarShadow } ) => {
23
24
const homeCommunities = R . filter ( R . propEq ( 'raw' , 'home' ) , items )
24
25
const sortableCommunities = R . reject ( R . propEq ( 'raw' , 'home' ) , items )
25
26
26
27
return (
27
28
< Wrapper >
28
29
{ 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
+ />
30
37
) ) }
31
38
< OverlayScrollbarsComponent
32
39
options = { { scrollbars : { autoHide : 'scroll' , autoHideDelay : 200 } } }
33
40
className = "os-theme-light"
34
41
>
35
42
< 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 >
46
56
</ ScrollWrapper >
47
57
</ OverlayScrollbarsComponent >
48
58
</ Wrapper >
0 commit comments