diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-03-05 17:55:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-05 09:55:55 -0800 |
commit | a62fe855c3625a1798eae38cca08bc6c1686c863 (patch) | |
tree | 6a2d2c1b5f3aded3e67924bb4dfedb054f1e39ac /src/view/com/util/LoadingPlaceholder.tsx | |
parent | c5d9e282e51f410ea80a9059ac680818c41d406e (diff) | |
download | voidsky-a62fe855c3625a1798eae38cca08bc6c1686c863.tar.zst |
skeletons for chat list (#7907)
Diffstat (limited to 'src/view/com/util/LoadingPlaceholder.tsx')
-rw-r--r-- | src/view/com/util/LoadingPlaceholder.tsx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/view/com/util/LoadingPlaceholder.tsx b/src/view/com/util/LoadingPlaceholder.tsx index b4a5681d8..eee642df3 100644 --- a/src/view/com/util/LoadingPlaceholder.tsx +++ b/src/view/com/util/LoadingPlaceholder.tsx @@ -1,3 +1,4 @@ +import {useMemo} from 'react' import { DimensionValue, StyleProp, @@ -282,6 +283,47 @@ export function FeedFeedLoadingPlaceholder() { ) } +export function ChatListItemLoadingPlaceholder({ + style, +}: { + style?: StyleProp<ViewStyle> +}) { + const t = useTheme_NEW() + const random = useMemo(() => Math.random(), []) + return ( + <View style={[a.flex_row, a.gap_md, a.px_lg, a.mt_lg, t.atoms.bg, style]}> + <LoadingPlaceholder width={52} height={52} style={a.rounded_full} /> + <View> + <LoadingPlaceholder width={140} height={12} style={a.mt_xs} /> + <LoadingPlaceholder width={120} height={8} style={a.mt_sm} /> + <LoadingPlaceholder + width={80 + random * 100} + height={8} + style={a.mt_sm} + /> + </View> + </View> + ) +} + +export function ChatListLoadingPlaceholder() { + return ( + <> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + <ChatListItemLoadingPlaceholder /> + </> + ) +} + const styles = StyleSheet.create({ loadingPlaceholder: { borderRadius: 6, |