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

Commit 388387d

Browse files
committed
feat(scrollbar): add custom-scrollbar to preview viewer
1 parent a05ea28 commit 388387d

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

containers/Preview/Viewer.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ import {
1919
DynamicStateTree,
2020
} from './DynamicComps'
2121

22+
import { Wrapper } from './styles/viewer'
2223
import DefaultViewer from './DefaultViewer'
2324
import { closePreview } from './logic'
2425

25-
const Viewer = ({ type, root, attachment, attUser }) => {
26+
const renderViewer = (type, root, attachment, attUser) => {
2627
switch (type) {
2728
case TYPE.PREVIEW_ACCOUNT_VIEW:
2829
return <DynamicAccountViewer />
@@ -83,4 +84,10 @@ const Viewer = ({ type, root, attachment, attUser }) => {
8384
}
8485
}
8586

87+
const Viewer = ({ type, root, attachment, attUser }) => (
88+
<Wrapper id="preview-viewer-scroller">
89+
{renderViewer(type, root, attachment, attUser)}
90+
</Wrapper>
91+
)
92+
8693
export default Viewer

containers/Preview/logic.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ export const useInit = _store => {
8989

9090
sub$ = sr71$.data().subscribe($solver(DataResolver, []))
9191

92+
/* eslint-disable no-undef */
93+
OverlayScrollbars(document.getElementById('preview-viewer-scroller'), {})
94+
9295
return () => {
9396
if (!sub$) return false
9497
sr71$.stop()

containers/Preview/styles/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export const PreviewOverlay = styled.div`
4040
top: 0;
4141
visibility: ${({ visible }) => (visible ? 'visible' : 'hidden')};
4242
`
43-
4443
export const PreviewWrapper = styled.div`
4544
${cs.flex()};
4645
color: ${theme('preview.font')};

containers/Preview/styles/viewer.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import styled from 'styled-components'
2+
3+
export const Wrapper = styled.div.attrs(({ id }) => ({
4+
id,
5+
}))`
6+
height: calc(100% - 10px);
7+
width: 100%;
8+
`
9+
10+
export const holder = 1

0 commit comments

Comments
 (0)