add subtle web hover to "View full thread" (#6256)
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
export function SubtleWebHover({}: {hover: boolean}) {
|
import {ViewStyleProp} from '#/alf'
|
||||||
|
|
||||||
|
export function SubtleWebHover({}: ViewStyleProp & {hover: boolean}) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ import React from 'react'
|
|||||||
import {StyleSheet, View} from 'react-native'
|
import {StyleSheet, View} from 'react-native'
|
||||||
|
|
||||||
import {isTouchDevice} from '#/lib/browser'
|
import {isTouchDevice} from '#/lib/browser'
|
||||||
import {useTheme} from '#/alf'
|
import {useTheme, ViewStyleProp} from '#/alf'
|
||||||
|
|
||||||
export function SubtleWebHover({hover}: {hover: boolean}) {
|
export function SubtleWebHover({
|
||||||
|
style,
|
||||||
|
hover,
|
||||||
|
}: ViewStyleProp & {hover: boolean}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
if (isTouchDevice) {
|
if (isTouchDevice) {
|
||||||
return null
|
return null
|
||||||
@@ -26,9 +29,8 @@ export function SubtleWebHover({hover}: {hover: boolean}) {
|
|||||||
style={[
|
style={[
|
||||||
t.atoms.bg_contrast_25,
|
t.atoms.bg_contrast_25,
|
||||||
styles.container,
|
styles.container,
|
||||||
{
|
{opacity: hover ? opacity : 0},
|
||||||
opacity: hover ? opacity : 0,
|
style,
|
||||||
},
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import {Trans} from '@lingui/macro'
|
|||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {makeProfileLink} from '#/lib/routes/links'
|
import {makeProfileLink} from '#/lib/routes/links'
|
||||||
import {FeedPostSlice} from '#/state/queries/post-feed'
|
import {FeedPostSlice} from '#/state/queries/post-feed'
|
||||||
|
import {useInteractionState} from '#/components/hooks/useInteractionState'
|
||||||
|
import {SubtleWebHover} from '#/components/SubtleWebHover'
|
||||||
import {Link} from '../util/Link'
|
import {Link} from '../util/Link'
|
||||||
import {Text} from '../util/text/Text'
|
import {Text} from '../util/text/Text'
|
||||||
import {FeedItem} from './FeedItem'
|
import {FeedItem} from './FeedItem'
|
||||||
@@ -108,6 +110,11 @@ FeedSlice = memo(FeedSlice)
|
|||||||
export {FeedSlice}
|
export {FeedSlice}
|
||||||
|
|
||||||
function ViewFullThread({uri}: {uri: string}) {
|
function ViewFullThread({uri}: {uri: string}) {
|
||||||
|
const {
|
||||||
|
state: hover,
|
||||||
|
onIn: onHoverIn,
|
||||||
|
onOut: onHoverOut,
|
||||||
|
} = useInteractionState()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const itemHref = React.useMemo(() => {
|
const itemHref = React.useMemo(() => {
|
||||||
const urip = new AtUri(uri)
|
const urip = new AtUri(uri)
|
||||||
@@ -115,7 +122,18 @@ function ViewFullThread({uri}: {uri: string}) {
|
|||||||
}, [uri])
|
}, [uri])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link style={[styles.viewFullThread]} href={itemHref} asAnchor noFeedback>
|
<Link
|
||||||
|
style={[styles.viewFullThread]}
|
||||||
|
href={itemHref}
|
||||||
|
asAnchor
|
||||||
|
noFeedback
|
||||||
|
onPointerEnter={onHoverIn}
|
||||||
|
onPointerLeave={onHoverOut}>
|
||||||
|
<SubtleWebHover
|
||||||
|
hover={hover}
|
||||||
|
// adjust position for visual alignment - the actual box has lots of top padding and not much bottom padding -sfn
|
||||||
|
style={{top: 8, bottom: -5}}
|
||||||
|
/>
|
||||||
<View style={styles.viewFullThreadDots}>
|
<View style={styles.viewFullThreadDots}>
|
||||||
<Svg width="4" height="40">
|
<Svg width="4" height="40">
|
||||||
<Line
|
<Line
|
||||||
|
|||||||
Reference in New Issue
Block a user