diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 9edca4335d..e8fdc47f79 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -38,6 +38,7 @@ import {PreviewableUserAvatar} from '#/view/com/util/UserAvatar' import {atoms as a, useTheme} from '#/alf' import {colors} from '#/components/Admonition' import {Button} from '#/components/Button' +import {useInteractionState} from '#/components/hooks/useInteractionState' import {CalendarClock_Stroke2_Corner0_Rounded as CalendarClockIcon} from '#/components/icons/CalendarClock' import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRightIcon} from '#/components/icons/Chevron' import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash' @@ -656,26 +657,24 @@ function PostOuterWrapper({ hideTopBorder?: boolean }>) { const t = useTheme() - const [hover, setHover] = React.useState(false) + const { + state: hover, + onIn: onHoverIn, + onOut: onHoverOut, + } = useInteractionState() if (treeView && depth > 0) { return ( { - setHover(true) - }} - onPointerLeave={() => { - setHover(false) - }}> + onPointerEnter={onHoverIn} + onPointerLeave={onHoverOut}> {Array.from(Array(depth - 1)).map((_, n: number) => ( ))} - {children} + + + {children} + ) } return ( { - setHover(true) - }} - onPointerLeave={() => { - setHover(false) - }} + onPointerEnter={onHoverIn} + onPointerLeave={onHoverOut} style={[ a.border_t, a.px_sm,