@@ -2,7 +2,7 @@ import { ActionButton } from "@follow/components/ui/button/index.js"
2
2
import { Skeleton } from "@follow/components/ui/skeleton/index.jsx"
3
3
import { cn } from "@follow/utils/utils"
4
4
import { atom } from "jotai"
5
- import { useLayoutEffect , useRef } from "react"
5
+ import { useLayoutEffect , useRef , useState } from "react"
6
6
7
7
import { RelativeTime } from "~/components/ui/datetime"
8
8
import { Media } from "~/components/ui/media"
@@ -33,7 +33,7 @@ export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, transl
33
33
const feed = useFeedById ( entry ?. feedId )
34
34
35
35
const ref = useRef < HTMLDivElement > ( null )
36
-
36
+ const [ showAction , setShowAction ] = useState ( false )
37
37
useLayoutEffect ( ( ) => {
38
38
if ( ref . current ) {
39
39
jotaiStore . set ( socialMediaContentWidthAtom , ref . current . offsetWidth )
@@ -50,6 +50,8 @@ export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, transl
50
50
51
51
return (
52
52
< div
53
+ onMouseEnter = { ( ) => setShowAction ( true ) }
54
+ onMouseLeave = { ( ) => setShowAction ( false ) }
53
55
className = { cn (
54
56
"relative flex px-8 py-6" ,
55
57
"group" ,
@@ -157,14 +159,11 @@ export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, transl
157
159
) }
158
160
</ div >
159
161
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
+ ) }
168
167
</ div >
169
168
)
170
169
}
0 commit comments