Add tiny option in RightNav

This commit is contained in:
Eric Bailey
2024-12-11 17:03:53 -06:00
parent 6287bf6c44
commit 0ff6151ab8
2 changed files with 82 additions and 12 deletions
+40 -3
View File
@@ -6,7 +6,7 @@ import {atoms as a, useGutters, useTheme, ViewStyleProp} from '#/alf'
import {Link as InternalLink, LinkProps} from '#/components/Link' import {Link as InternalLink, LinkProps} from '#/components/Link'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
export function Topic({topic, style}: {topic: string} & ViewStyleProp) { export function TopicLarge({topic, style}: {topic: string} & ViewStyleProp) {
const t = useTheme() const t = useTheme()
return ( return (
<View <View
@@ -18,7 +18,30 @@ export function Topic({topic, style}: {topic: string} & ViewStyleProp) {
t.atoms.border_contrast_medium, t.atoms.border_contrast_medium,
style, style,
]}> ]}>
<Text style={[a.text_md, a.font_bold, a.leading_snug]} numberOfLines={1}> <Text
style={[a.flex_1, a.text_md, a.font_bold, a.leading_tight]}
numberOfLines={1}>
{topic}
</Text>
</View>
)
}
export function TopicSmall({topic, style}: {topic: string} & ViewStyleProp) {
const t = useTheme()
return (
<View
style={[
a.p_xs,
a.px_sm,
a.rounded_sm,
a.border,
t.atoms.border_contrast_medium,
style,
]}>
<Text
style={[a.flex_1, a.text_sm, a.font_bold, a.leading_tight]}
numberOfLines={1}>
{topic} {topic}
</Text> </Text>
</View> </View>
@@ -56,7 +79,7 @@ export function Grid({topics}: {topics: string[]}) {
{topics.map(topic => ( {topics.map(topic => (
<Link key={topic} topic={topic}> <Link key={topic} topic={topic}>
{({hovered}) => ( {({hovered}) => (
<Topic <TopicLarge
topic={topic} topic={topic}
style={[ style={[
hovered && [ hovered && [
@@ -71,3 +94,17 @@ export function Grid({topics}: {topics: string[]}) {
</View> </View>
) )
} }
// temp
export const TOPICS = [
'#atproto',
'South Korea',
'Wired',
'Basket Weaving',
'Coup',
'Chappel Roan',
'the juice',
'Superman',
'#FCF',
'Open Web',
]
+42 -9
View File
@@ -9,8 +9,11 @@ import {useSession} from '#/state/session'
import {DesktopFeeds} from '#/view/shell/desktop/Feeds' import {DesktopFeeds} from '#/view/shell/desktop/Feeds'
import {DesktopSearch} from '#/view/shell/desktop/Search' import {DesktopSearch} from '#/view/shell/desktop/Search'
import {atoms as a, useGutters, useTheme, web} from '#/alf' import {atoms as a, useGutters, useTheme, web} from '#/alf'
import {Divider} from '#/components/Divider'
import {Trending2_Stroke2_Corner2_Rounded as Graph} from '#/components/icons/Trending2'
import {InlineLinkText} from '#/components/Link' import {InlineLinkText} from '#/components/Link'
import {ProgressGuideList} from '#/components/ProgressGuide/List' import {ProgressGuideList} from '#/components/ProgressGuide/List'
import * as Trending from '#/components/TrendingTopics'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
export function DesktopRightNav({routeName}: {routeName: string}) { export function DesktopRightNav({routeName}: {routeName: string}) {
@@ -19,6 +22,7 @@ export function DesktopRightNav({routeName}: {routeName: string}) {
const {hasSession, currentAccount} = useSession() const {hasSession, currentAccount} = useSession()
const kawaii = useKawaiiMode() const kawaii = useKawaiiMode()
const gutters = useGutters(['base', 0, 'base', 'wide']) const gutters = useGutters(['base', 0, 'base', 'wide'])
const isSearchScreen = routeName === 'Search'
const {isTablet} = useWebMediaQueries() const {isTablet} = useWebMediaQueries()
if (isTablet) { if (isTablet) {
@@ -29,6 +33,7 @@ export function DesktopRightNav({routeName}: {routeName: string}) {
<View <View
style={[ style={[
gutters, gutters,
a.gap_lg,
web({ web({
position: 'fixed', position: 'fixed',
left: '50%', left: '50%',
@@ -43,18 +48,46 @@ export function DesktopRightNav({routeName}: {routeName: string}) {
overflowY: 'auto', overflowY: 'auto',
}), }),
]}> ]}>
{routeName !== 'Search' && ( {!isSearchScreen && <DesktopSearch />}
<View style={[a.pb_lg]}>
<DesktopSearch />
</View>
)}
{hasSession && ( {hasSession && (
<> <>
<ProgressGuideList style={[a.pb_xl]} /> <ProgressGuideList />
<View <DesktopFeeds />
style={[a.pb_lg, a.mb_lg, a.border_b, t.atoms.border_contrast_low]}> <Divider />
<DesktopFeeds /> </>
)}
{!isSearchScreen && (
<>
<View style={[a.gap_md]}>
<View style={[a.flex_row, a.align_center, a.gap_xs]}>
<Graph size="sm" />
<Text
style={[a.text_sm, a.font_bold, t.atoms.text_contrast_medium]}>
<Trans>Trending</Trans>
</Text>
</View>
<View style={[a.flex_row, a.flex_wrap, a.gap_xs]}>
{Trending.TOPICS.slice(0, 8).map(topic => (
<Trending.Link key={topic} topic={topic}>
{({hovered}) => (
<Trending.TopicSmall
topic={topic}
style={[
hovered && [
t.atoms.border_contrast_high,
t.atoms.bg_contrast_25,
],
]}
/>
)}
</Trending.Link>
))}
</View>
</View> </View>
<Divider />
</> </>
)} )}