tweak spacing/alignment, add underline on hover

This commit is contained in:
Samuel Newman
2026-01-09 20:25:50 +02:00
parent 7cc7fe5aea
commit 7090c3d6ad
@@ -1,9 +1,8 @@
import React from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {msg, Trans} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {logEvent} from '#/lib/statsig/statsig' import {logger} from '#/logger'
import { import {
useTrendingSettings, useTrendingSettings,
useTrendingSettingsApi, useTrendingSettingsApi,
@@ -34,10 +33,10 @@ function Inner() {
const {data: trending, error, isLoading} = useTrendingTopics() const {data: trending, error, isLoading} = useTrendingTopics()
const noTopics = !isLoading && !error && !trending?.topics?.length const noTopics = !isLoading && !error && !trending?.topics?.length
const onConfirmHide = React.useCallback(() => { const onConfirmHide = () => {
logEvent('trendingTopics:hide', {context: 'sidebar'}) logger.metric('trendingTopics:hide', {context: 'sidebar'})
setTrendingDisabled(true) setTrendingDisabled(true)
}, [setTrendingDisabled]) }
return error || noTopics ? null : ( return error || noTopics ? null : (
<> <>
@@ -60,7 +59,7 @@ function Inner() {
</Button> </Button>
</View> </View>
<View style={[a.gap_sm]}> <View style={[a.gap_xs]}>
{isLoading ? ( {isLoading ? (
Array(TRENDING_LIMIT) Array(TRENDING_LIMIT)
.fill(0) .fill(0)
@@ -91,13 +90,14 @@ function Inner() {
topic={topic} topic={topic}
style={[a.self_start]} style={[a.self_start]}
onPress={() => { onPress={() => {
logEvent('trendingTopic:click', {context: 'sidebar'}) logger.metric('trendingTopic:click', {context: 'sidebar'})
}}> }}>
{({hovered}) => ( {({hovered}) => (
<View style={[a.flex_row, a.align_center, a.gap_xs]}> <View style={[a.flex_row, a.align_center, a.gap_xs]}>
<Text <Text
style={[ style={[
a.text_sm, a.text_sm,
a.leading_snug,
t.atoms.text_contrast_low, t.atoms.text_contrast_low,
{minWidth: 16}, {minWidth: 16},
]}> ]}>
@@ -106,7 +106,10 @@ function Inner() {
<Text <Text
style={[ style={[
a.text_sm, a.text_sm,
hovered ? t.atoms.text : t.atoms.text_contrast_medium, a.leading_snug,
hovered
? [t.atoms.text, a.underline]
: t.atoms.text_contrast_medium,
]} ]}
numberOfLines={1}> numberOfLines={1}>
{topic.displayName ?? topic.topic} {topic.displayName ?? topic.topic}