Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F123425747
useOverlayOffset.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jul 27, 07:33
Size
793 B
Mime Type
text/x-java
Expires
Tue, Jul 29, 07:33 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27666219
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useOverlayOffset.js
View Options
import
{
useMemo
,
useRef
}
from
'react'
;
import
hasClass
from
'dom-helpers/hasClass'
;
import
{
useBootstrapPrefix
}
from
'./ThemeProvider'
;
import
Popover
from
'./Popover'
;
// This is meant for internal use.
// This applies a custom offset to the overlay if it's a popover.
export
default
function
useOverlayOffset
(
customOffset
)
{
const
overlayRef
=
useRef
(
null
);
const
popoverClass
=
useBootstrapPrefix
(
undefined
,
'popover'
);
const
offset
=
useMemo
(()
=>
({
name
:
'offset'
,
options
:
{
offset
:
()
=>
{
if
(
overlayRef
.
current
&&
hasClass
(
overlayRef
.
current
,
popoverClass
))
{
return
customOffset
||
Popover
.
POPPER_OFFSET
;
}
return
customOffset
||
[
0
,
0
];
}
}
}),
[
customOffset
,
popoverClass
]);
return
[
overlayRef
,
[
offset
]];
}
Event Timeline
Log In to Comment