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

Commit 6758d37

Browse files
committed
chore: Merge branch 'custom-scrollbar' into dev
2 parents a05ea28 + 2df9f4c commit 6758d37

File tree

9 files changed

+32
-14
lines changed

9 files changed

+32
-14
lines changed

containers/Doraemon/ResultsList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const HintIcon = ({ index, active, cur, length }) => {
3030
}
3131

3232
const ResultsList = ({ searchValue, searchThread, suggestions, activeRaw }) => (
33-
<Wrapper>
33+
<Wrapper id="suggestion-scroller">
3434
<SuggestionWrapper empty={suggestions.length === 0}>
3535
{suggestions.map((suggestion, i) => (
3636
<InfoBar

containers/Doraemon/styles/results_list.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import styled from 'styled-components'
33
import Img from '@components/Img'
44
import { theme, animate, cs } from '@utils'
55

6-
export const Wrapper = styled.div.attrs(() => ({
7-
id: 'suggestion-scroller',
6+
export const Wrapper = styled.div.attrs(({ id }) => ({
7+
id,
88
}))`
99
width: 100%;
1010
overflow: hidden;

containers/GlobalLayout/logic.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ export const useInit = (_store, extra) => {
2323
store = _store
2424

2525
// FIXME: do not show body scrollbar on mac
26+
// plus this plugin will break antd's affix staff
2627
/* eslint-disable no-undef */
27-
OverlayScrollbars(document.querySelectorAll('body'), {
28-
// NOT WORK!
29-
// scrollbars: { autoHide: 'scroll', autoHideDelay: 500 },
30-
})
28+
// OverlayScrollbars(document.querySelectorAll('body'), {
29+
// NOT WORK!
30+
// scrollbars: { autoHide: 'scroll', autoHideDelay: 500 },
31+
// })
3132

3233
const { online, media, platform } = extra
3334
store.markState({ online, media, platform })

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')};
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

containers/Sidebar/MenuList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const MenuList = SortableContainer(
2323

2424
return (
2525
<Wrapper>
26-
<ScrollWrapper>
26+
<ScrollWrapper id="sidebar-scroller">
2727
{homeCommunities.map(item => (
2828
<MenuBar
2929
key={item.raw}

containers/Sidebar/styles/menu_list.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ export const Wrapper = styled.div`
1010
// overflow-y: scroll;
1111
transition: left 0.2s;
1212
`
13-
export const ScrollWrapper = styled.div.attrs(() => ({
14-
id: 'sidebar-scroller',
13+
export const ScrollWrapper = styled.div.attrs(({ id }) => ({
14+
id,
1515
}))`
16-
// max-height: calc(100% - 20px);
17-
// height 500px;
1816
height: calc(100% - 20px);
1917
`

0 commit comments

Comments
 (0)