Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
81fccb17
Commit
81fccb17
authored
Aug 08, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize: overlay scrollbar
parent
a0e4c368
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
21 deletions
+42
-21
src/ui/Shared/Scrollbar/index.tsx
src/ui/Shared/Scrollbar/index.tsx
+42
-21
No files found.
src/ui/Shared/Scrollbar/index.tsx
View file @
81fccb17
import
{
OverlayScrollbarsComponent
}
from
"
overlayscrollbars-react
"
;
import
{
OverlayScrollbarsComponent
,
OverlayScrollbarsComponentProps
,
}
from
"
overlayscrollbars-react
"
;
/**
* @desc 创建漂亮的滚动条,包裹一些可能溢出的元素。
* @why chrome在113之后,取消了overflow: overlay的支持,所以需要使用overlayScrollbars来实现。
*/
export
const
ScrollableArea
:
React
.
FC
<
export
const
ScrollableArea
:
React
.
FC
<
React
.
ComponentProps
<
typeof
OverlayScrollbarsComponent
>
React
.
PropsWithChildren
<
{
>
=
({
options
,
children
,
...
rest
})
=>
(
scrollProps
?:
OverlayScrollbarsComponentProps
;
<
OverlayScrollbarsComponent
elementProps
?:
React
.
HTMLAttributes
<
HTMLElement
>
;
options=
{
{
className
?:
string
;
scrollbars
:
{
style
?:
React
.
CSSProperties
;
autoHide
:
"
scroll
"
,
}
>
theme
:
"
os-theme-light
"
,
>
=
({
scrollProps
=
{},
elementProps
,
className
,
style
,
children
})
=>
{
},
const
{
options
=
{},
...
rest
}
=
scrollProps
;
overflow
:
{
scrollProps
;
x
:
"
hidden
"
,
return
(
y
:
"
scroll
"
,
<
OverlayScrollbarsComponent
},
options=
{
{
...
options
,
scrollbars
:
{
}
}
autoHide
:
"
scroll
"
,
defer
theme
:
"
os-theme-light
"
,
{
...
rest
}
},
>
overflow
:
{
{
children
}
x
:
"
hidden
"
,
</
OverlayScrollbarsComponent
>
y
:
"
scroll
"
,
);
},
...
options
,
}
}
defer
style=
{
{
height
:
"
100%
"
,
}
}
{
...
rest
}
>
<
div
className=
{
className
}
style=
{
style
}
{
...
elementProps
}
>
{
children
}
</
div
>
</
OverlayScrollbarsComponent
>
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment