This repository has been archived by the owner on Jun 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: bullet chat will show in first time
- Loading branch information
1 parent
c677b7e
commit 13f632b
Showing
3 changed files
with
57 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { | ||
FC, | ||
PropsWithChildren, | ||
HTMLAttributes, | ||
useRef, | ||
MouseEvent | ||
} from 'react'; | ||
|
||
interface IHoverDelayProps extends HTMLAttributes<HTMLDivElement> { | ||
delay: number; | ||
onMouseHover: (e: MouseEvent) => void; | ||
} | ||
|
||
const HoverDelay: FC<PropsWithChildren<IHoverDelayProps>> = (props) => { | ||
const { delay, children, onMouseHover, ...rest } = props; | ||
const delayTimer = useRef<NodeJS.Timeout | null>(null); | ||
|
||
const handleMouseEnter = (e: MouseEvent<HTMLDivElement>) => { | ||
rest.onMouseEnter && rest.onMouseEnter(e); | ||
delayTimer.current = setTimeout(() => { | ||
onMouseHover(e); | ||
}, delay); | ||
}; | ||
|
||
const handleMouseLeave = (e: MouseEvent<HTMLDivElement>) => { | ||
rest.onMouseLeave && rest.onMouseLeave(e); | ||
delayTimer.current && clearTimeout(delayTimer.current); | ||
}; | ||
|
||
return ( | ||
<div | ||
{...rest} | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default HoverDelay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,7 @@ | |
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
z-index: 2; | ||
|
||
.fakeBulletChatItem { | ||
display: inline; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters