Skip to content

Commit

Permalink
Add loading state to new trending interstitial (#7332)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Jan 2, 2025
1 parent 3e0ed3b commit 85ad52e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
28 changes: 27 additions & 1 deletion src/components/interstitials/Trending.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '#/state/preferences/trending'
import {useTrendingTopics} from '#/state/queries/trending/useTrendingTopics'
import {useTrendingConfig} from '#/state/trending-config'
import {LoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
import {atoms as a, useGutters, useTheme} from '#/alf'
import {Button, ButtonIcon} from '#/components/Button'
import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times'
Expand Down Expand Up @@ -50,7 +51,32 @@ export function Inner() {
<Graph size="sm" />
</View>
{isLoading ? (
<View style={[a.py_lg]}>
<View style={[a.py_lg, a.flex_row, a.gap_lg, a.align_center]}>
<LoadingPlaceholder
width={80}
height={undefined}
style={{alignSelf: 'stretch'}}
/>
<LoadingPlaceholder
width={50}
height={undefined}
style={{alignSelf: 'stretch'}}
/>
<LoadingPlaceholder
width={120}
height={undefined}
style={{alignSelf: 'stretch'}}
/>
<LoadingPlaceholder
width={30}
height={undefined}
style={{alignSelf: 'stretch'}}
/>
<LoadingPlaceholder
width={180}
height={undefined}
style={{alignSelf: 'stretch'}}
/>
<Text
style={[t.atoms.text_contrast_medium, a.text_sm, a.font_bold]}>
{' '}
Expand Down
2 changes: 1 addition & 1 deletion src/view/com/util/LoadingPlaceholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function LoadingPlaceholder({
style,
}: {
width: DimensionValue
height: DimensionValue
height: DimensionValue | undefined
style?: StyleProp<ViewStyle>
}) {
const theme = useTheme()
Expand Down

0 comments on commit 85ad52e

Please sign in to comment.