Add trending header if not top module
This commit is contained in:
@@ -50,6 +50,7 @@ import {type Props as IcoProps} from '#/components/icons/common'
|
|||||||
import {type Props as SVGIconProps} from '#/components/icons/common'
|
import {type Props as SVGIconProps} from '#/components/icons/common'
|
||||||
import {ListSparkle_Stroke2_Corner0_Rounded as ListSparkle} from '#/components/icons/ListSparkle'
|
import {ListSparkle_Stroke2_Corner0_Rounded as ListSparkle} from '#/components/icons/ListSparkle'
|
||||||
import {StarterPack} from '#/components/icons/StarterPack'
|
import {StarterPack} from '#/components/icons/StarterPack'
|
||||||
|
import {Trending2_Stroke2_Corner2_Rounded as Graph} from '#/components/icons/Trending'
|
||||||
import {UserCircle_Stroke2_Corner0_Rounded as Person} from '#/components/icons/UserCircle'
|
import {UserCircle_Stroke2_Corner0_Rounded as Person} from '#/components/icons/UserCircle'
|
||||||
import {Loader} from '#/components/Loader'
|
import {Loader} from '#/components/Loader'
|
||||||
import * as ProfileCard from '#/components/ProfileCard'
|
import * as ProfileCard from '#/components/ProfileCard'
|
||||||
@@ -107,6 +108,7 @@ type ExploreScreenItems =
|
|||||||
title: string
|
title: string
|
||||||
icon: React.ComponentType<SVGIconProps>
|
icon: React.ComponentType<SVGIconProps>
|
||||||
iconSize?: IcoProps['size']
|
iconSize?: IcoProps['size']
|
||||||
|
bottomBorder?: boolean
|
||||||
searchButton?: {
|
searchButton?: {
|
||||||
label: string
|
label: string
|
||||||
metricsTag: MetricEvents['explore:module:searchButtonPress']['module']
|
metricsTag: MetricEvents['explore:module:searchButtonPress']['module']
|
||||||
@@ -532,6 +534,13 @@ export function Explore({
|
|||||||
if (isNewUser) {
|
if (isNewUser) {
|
||||||
i.push(...suggestedFollowsModule)
|
i.push(...suggestedFollowsModule)
|
||||||
i.push(...suggestedStarterPacksModule)
|
i.push(...suggestedStarterPacksModule)
|
||||||
|
i.push({
|
||||||
|
type: 'header',
|
||||||
|
key: 'trending-topics-header',
|
||||||
|
title: _(msg`Trending topics`),
|
||||||
|
icon: Graph,
|
||||||
|
bottomBorder: true,
|
||||||
|
})
|
||||||
i.push(trendingTopicsModule)
|
i.push(trendingTopicsModule)
|
||||||
} else {
|
} else {
|
||||||
i.push(trendingTopicsModule)
|
i.push(trendingTopicsModule)
|
||||||
@@ -545,6 +554,7 @@ export function Explore({
|
|||||||
|
|
||||||
return i
|
return i
|
||||||
}, [
|
}, [
|
||||||
|
_,
|
||||||
topBorder,
|
topBorder,
|
||||||
isNewUser,
|
isNewUser,
|
||||||
suggestedFollowsModule,
|
suggestedFollowsModule,
|
||||||
@@ -576,7 +586,7 @@ export function Explore({
|
|||||||
)
|
)
|
||||||
case 'header': {
|
case 'header': {
|
||||||
return (
|
return (
|
||||||
<ModuleHeader.Container>
|
<ModuleHeader.Container bottomBorder={item.bottomBorder}>
|
||||||
<ModuleHeader.Icon icon={item.icon} size={item.iconSize} />
|
<ModuleHeader.Icon icon={item.icon} size={item.iconSize} />
|
||||||
<ModuleHeader.TitleText>{item.title}</ModuleHeader.TitleText>
|
<ModuleHeader.TitleText>{item.title}</ModuleHeader.TitleText>
|
||||||
{item.searchButton && (
|
{item.searchButton && (
|
||||||
@@ -760,6 +770,8 @@ export function Explore({
|
|||||||
<ModuleHeader.Container
|
<ModuleHeader.Container
|
||||||
headerHeight={headerHeight}
|
headerHeight={headerHeight}
|
||||||
style={[a.pt_xs, a.border_b, t.atoms.border_contrast_low]}>
|
style={[a.pt_xs, a.border_b, t.atoms.border_contrast_low]}>
|
||||||
|
{/* Very non-scientific way to avoid small gap on scroll */}
|
||||||
|
<View style={[a.absolute, a.inset_0, t.atoms.bg, {top: -2}]} />
|
||||||
<ModuleHeader.FeedLink feed={item.feed}>
|
<ModuleHeader.FeedLink feed={item.feed}>
|
||||||
<ModuleHeader.FeedAvatar feed={item.feed} />
|
<ModuleHeader.FeedAvatar feed={item.feed} />
|
||||||
<View style={[a.flex_1, a.gap_xs]}>
|
<View style={[a.flex_1, a.gap_xs]}>
|
||||||
|
|||||||
@@ -18,7 +18,12 @@ export function Container({
|
|||||||
style,
|
style,
|
||||||
children,
|
children,
|
||||||
headerHeight,
|
headerHeight,
|
||||||
}: {children: React.ReactNode; headerHeight?: number} & ViewStyleProp) {
|
bottomBorder,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode
|
||||||
|
headerHeight?: number
|
||||||
|
bottomBorder?: boolean
|
||||||
|
} & ViewStyleProp) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
@@ -31,10 +36,9 @@ export function Container({
|
|||||||
a.gap_sm,
|
a.gap_sm,
|
||||||
t.atoms.bg,
|
t.atoms.bg,
|
||||||
headerHeight && web({position: 'sticky', top: headerHeight}),
|
headerHeight && web({position: 'sticky', top: headerHeight}),
|
||||||
|
bottomBorder && [a.border_b, t.atoms.border_contrast_low],
|
||||||
style,
|
style,
|
||||||
]}>
|
]}>
|
||||||
{/* Very non-scientific way to avoid small gap on scroll */}
|
|
||||||
<View style={[a.absolute, a.inset_0, t.atoms.bg, {top: -2}]} />
|
|
||||||
{children}
|
{children}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user