@@ -2,7 +2,7 @@ import { ActionButton } from "@follow/components/ui/button/index.js"
22import { Skeleton } from "@follow/components/ui/skeleton/index.jsx"
33import { cn } from "@follow/utils/utils"
44import { atom } from "jotai"
5- import { useLayoutEffect , useRef } from "react"
5+ import { useLayoutEffect , useRef , useState } from "react"
66
77import { RelativeTime } from "~/components/ui/datetime"
88import { Media } from "~/components/ui/media"
@@ -33,7 +33,7 @@ export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, transl
3333 const feed = useFeedById ( entry ?. feedId )
3434
3535 const ref = useRef < HTMLDivElement > ( null )
36-
36+ const [ showAction , setShowAction ] = useState ( false )
3737 useLayoutEffect ( ( ) => {
3838 if ( ref . current ) {
3939 jotaiStore . set ( socialMediaContentWidthAtom , ref . current . offsetWidth )
@@ -50,6 +50,8 @@ export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, transl
5050
5151 return (
5252 < div
53+ onMouseEnter = { ( ) => setShowAction ( true ) }
54+ onMouseLeave = { ( ) => setShowAction ( false ) }
5355 className = { cn (
5456 "relative flex px-8 py-6" ,
5557 "group" ,
@@ -157,14 +159,11 @@ export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, transl
157159 ) }
158160 </ div >
159161
160- < div
161- className = { cn (
162- "absolute right-1 top-1.5" ,
163- "invisible opacity-0 duration-200 group-hover:visible group-hover:opacity-80" ,
164- ) }
165- >
166- < ActionBar entryId = { entryId } />
167- </ div >
162+ { showAction && (
163+ < div className = { "absolute right-1 top-1.5" } >
164+ < ActionBar entryId = { entryId } />
165+ </ div >
166+ ) }
168167 </ div >
169168 )
170169}
0 commit comments