Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit538b2ec

Browse files
committed
refactor(preview): use react-version of custom-scrollbar
1 parentb8755d8 commit538b2ec

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

‎src/containers/Preview/Viewer.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
importReactfrom'react'
2+
import{OverlayScrollbarsComponent}from'overlayscrollbars-react'
23

34
import{TYPE}from'@constant'
45

@@ -85,9 +86,11 @@ const renderViewer = (type, root, attachment, attUser) => {
8586
}
8687

8788
constViewer=({ type, root, attachment, attUser})=>(
88-
<Wrapperid="preview-viewer-scroller">
89-
{renderViewer(type,root,attachment,attUser)}
90-
</Wrapper>
89+
<OverlayScrollbarsComponent
90+
options={{scrollbars:{autoHide:'scroll',autoHideDelay:200}}}
91+
>
92+
<Wrapper>{renderViewer(type,root,attachment,attUser)}</Wrapper>
93+
</OverlayScrollbarsComponent>
9194
)
9295

9396
exportdefaultViewer

‎src/containers/Preview/index.js‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
importReactfrom'react'
88

99
import{connectStore,buildLog}from'@utils'
10-
import{useShortcut,usePlatform}from'@hooks'
10+
import{useShortcut}from'@hooks'
1111

1212
importSliderPreviewfrom'./SliderPreview'
1313
importModalPreviewfrom'./ModalPreview'
1414
importViewerfrom'./Viewer'
1515

16-
import{useInit,useScrollbar,closePreview}from'./logic'
16+
import{useInit,closePreview}from'./logic'
1717

1818
/* eslint-disable-next-line */
1919
constlog=buildLog('C:Preview')
@@ -22,9 +22,6 @@ const PreviewContainer = ({ preview }) => {
2222
useInit(preview)
2323
useShortcut('esc',closePreview)
2424

25-
const{ isMacOS}=usePlatform()
26-
useScrollbar(isMacOS)
27-
2825
const{
2926
modalVisible,
3027
slideVisible,

‎src/containers/Preview/logic.js‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,6 @@ const DataResolver = [
8383
// ###############################
8484
// init & uninit
8585
// ###############################
86-
exportconstuseScrollbar=isMacOS=>{
87-
useEffect(()=>{
88-
if(isMacOS){
89-
/* eslint-disable no-undef */
90-
OverlayScrollbars(document.getElementById('preview-viewer-scroller'),{})
91-
}
92-
},[isMacOS])
93-
}
94-
9586
exportconstuseInit=_store=>{
9687
useEffect(()=>{
9788
store=_store

‎src/containers/Preview/styles/viewer.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styled from 'styled-components'
33
exportconstWrapper=styled.div.attrs(({ id})=>({
44
id,
55
}))`
6-
height:calc(100% - 10px);
6+
height:100vh;
77
width: 100%;
88
`
99

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp