Add subtle web hover to treeview replies (#6142)
* add subtle web hover to treeview replies * don't highlight indentation * adjust position * clean up some styles
This commit is contained in:
@@ -38,6 +38,7 @@ import {PreviewableUserAvatar} from '#/view/com/util/UserAvatar'
|
|||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {colors} from '#/components/Admonition'
|
import {colors} from '#/components/Admonition'
|
||||||
import {Button} from '#/components/Button'
|
import {Button} from '#/components/Button'
|
||||||
|
import {useInteractionState} from '#/components/hooks/useInteractionState'
|
||||||
import {CalendarClock_Stroke2_Corner0_Rounded as CalendarClockIcon} from '#/components/icons/CalendarClock'
|
import {CalendarClock_Stroke2_Corner0_Rounded as CalendarClockIcon} from '#/components/icons/CalendarClock'
|
||||||
import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRightIcon} from '#/components/icons/Chevron'
|
import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRightIcon} from '#/components/icons/Chevron'
|
||||||
import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash'
|
import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash'
|
||||||
@@ -656,26 +657,24 @@ function PostOuterWrapper({
|
|||||||
hideTopBorder?: boolean
|
hideTopBorder?: boolean
|
||||||
}>) {
|
}>) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const [hover, setHover] = React.useState(false)
|
const {
|
||||||
|
state: hover,
|
||||||
|
onIn: onHoverIn,
|
||||||
|
onOut: onHoverOut,
|
||||||
|
} = useInteractionState()
|
||||||
if (treeView && depth > 0) {
|
if (treeView && depth > 0) {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.flex_row,
|
a.flex_row,
|
||||||
a.px_sm,
|
a.px_sm,
|
||||||
|
a.flex_row,
|
||||||
t.atoms.border_contrast_low,
|
t.atoms.border_contrast_low,
|
||||||
styles.cursor,
|
styles.cursor,
|
||||||
{
|
depth === 1 && a.border_t,
|
||||||
flexDirection: 'row',
|
|
||||||
borderTopWidth: depth === 1 ? a.border_t.borderTopWidth : 0,
|
|
||||||
},
|
|
||||||
]}
|
]}
|
||||||
onPointerEnter={() => {
|
onPointerEnter={onHoverIn}
|
||||||
setHover(true)
|
onPointerLeave={onHoverOut}>
|
||||||
}}
|
|
||||||
onPointerLeave={() => {
|
|
||||||
setHover(false)
|
|
||||||
}}>
|
|
||||||
{Array.from(Array(depth - 1)).map((_, n: number) => (
|
{Array.from(Array(depth - 1)).map((_, n: number) => (
|
||||||
<View
|
<View
|
||||||
key={`${post.uri}-padding-${n}`}
|
key={`${post.uri}-padding-${n}`}
|
||||||
@@ -689,18 +688,23 @@ function PostOuterWrapper({
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<View style={{flex: 1}}>{children}</View>
|
<View style={a.flex_1}>
|
||||||
|
<SubtleWebHover
|
||||||
|
hover={hover}
|
||||||
|
style={{
|
||||||
|
left: (depth === 1 ? 0 : 2) - a.pl_sm.paddingLeft,
|
||||||
|
right: -a.pr_sm.paddingRight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
onPointerEnter={() => {
|
onPointerEnter={onHoverIn}
|
||||||
setHover(true)
|
onPointerLeave={onHoverOut}
|
||||||
}}
|
|
||||||
onPointerLeave={() => {
|
|
||||||
setHover(false)
|
|
||||||
}}
|
|
||||||
style={[
|
style={[
|
||||||
a.border_t,
|
a.border_t,
|
||||||
a.px_sm,
|
a.px_sm,
|
||||||
|
|||||||
Reference in New Issue
Block a user