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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
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
Pipeline
#22962
failed with stages
in 13 minutes and 41 seconds
Changes
1
Pipelines
1
Show 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
<
React
.
ComponentProps
<
typeof
OverlayScrollbarsComponent
>
>
=
({
options
,
children
,
...
rest
})
=>
(
React
.
PropsWithChildren
<
{
scrollProps
?:
OverlayScrollbarsComponentProps
;
elementProps
?:
React
.
HTMLAttributes
<
HTMLElement
>
;
className
?:
string
;
style
?:
React
.
CSSProperties
;
}
>
>
=
({
scrollProps
=
{},
elementProps
,
className
,
style
,
children
})
=>
{
const
{
options
=
{},
...
rest
}
=
scrollProps
;
scrollProps
;
return
(
<
OverlayScrollbarsComponent
options=
{
{
scrollbars
:
{
...
...
@@ -16,8 +31,14 @@ export const ScrollableArea: React.FC<
...
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