Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit e3024f2

Browse files
committed
refactor(user-lister): improve scroll-bar
1 parent 538b2ec commit e3024f2

File tree

6 files changed

+20
-18
lines changed

6 files changed

+20
-18
lines changed

src/components/Modal/styles/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const CloseBtn = styled(Img)`
4949
right: 15px;
5050
top: 15px;
5151
display: ${({ show }) => (show ? 'block' : 'none')};
52+
z-index: ${cs.zIndex.modalCloseBtn};
5253
5354
&:hover {
5455
animation: ${animate.rotate360CloseRule};

src/containers/Preview/styles/viewer.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import styled from 'styled-components'
22

3-
export const Wrapper = styled.div.attrs(({ id }) => ({
4-
id,
5-
}))`
3+
export const Wrapper = styled.div`
64
height: 100vh;
75
width: 100%;
86
`

src/containers/UserLister/index.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import React from 'react'
8+
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'
89

910
import { TYPE } from '@constant'
1011
import { connectStore, buildLog } from '@utils'
@@ -64,16 +65,20 @@ const UserListerContainer = ({ userLister }) => {
6465

6566
return (
6667
<Modal width="700px" show={show} showCloseBtn onClose={onClose}>
67-
<Wrapper id="userlist-scroller">
68-
<HeaderInfo
69-
type={type}
70-
brief={brief}
71-
totalCount={pagedUsersData.totalCount}
72-
curCommunity={curCommunity}
73-
/>
68+
<OverlayScrollbarsComponent
69+
options={{ scrollbars: { autoHide: 'scroll', autoHideDelay: 200 } }}
70+
>
71+
<Wrapper>
72+
<HeaderInfo
73+
type={type}
74+
brief={brief}
75+
totalCount={pagedUsersData.totalCount}
76+
curCommunity={curCommunity}
77+
/>
7478

75-
{renderContent(curView, pagedUsersData, accountInfo)}
76-
</Wrapper>
79+
{renderContent(curView, pagedUsersData, accountInfo)}
80+
</Wrapper>
81+
</OverlayScrollbarsComponent>
7782
</Modal>
7883
)
7984
}

src/containers/UserLister/logic.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import R from 'ramda'
22
import { useEffect } from 'react'
33

4+
// eslint-disable-next-line import/named
45
import { PAGE_SIZE } from '@config'
56
import { TYPE, EVENT, ERR } from '@constant'
67
import { asyncSuit, buildLog, holdPage, unholdPage, errRescue } from '@utils'
@@ -167,9 +168,6 @@ export const useInit = _store => {
167168
// log('effect init')
168169
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
169170

170-
/* eslint-disable no-undef */
171-
// OverlayScrollbars(document.getElementById('userlist-scroller'), {})
172-
173171
return () => {
174172
// log('effect uninit')
175173
sr71$.stop()

src/containers/UserLister/styles/index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import styled from 'styled-components'
33
// import Img from '@components/Img'
44
import { cs } from '@utils'
55

6-
export const Wrapper = styled.div.attrs(({ id }) => ({
7-
id,
8-
}))`
6+
export const Wrapper = styled.div`
7+
height: 600px;
98
padding: 20px;
109
`
1110
export const MsgWrapper = styled.div`

utils/common_styles.js

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const zIndex = {
8989
preview: 2001,
9090
doraemonOverlay: 2600,
9191
doraemon: 2601,
92+
modalCloseBtn: 2000,
9293

9394
//
9495
sidebar: 1999,

0 commit comments

Comments
 (0)