diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-07-09 17:10:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-09 11:10:50 -0500 |
commit | 2d0eefebc338eee0d5d7e3e4c02bd6bba7f6baa0 (patch) | |
tree | f4a6b16a96c1ba0910e94359105857c9baadd51b /src/components/KnownFollowers.tsx | |
parent | 4360087ced80a5633781cf6f1c307606a1b0a210 (diff) | |
download | voidsky-2d0eefebc338eee0d5d7e3e4c02bd6bba7f6baa0.tar.zst |
Add social proof to suggested follows (#4602)
* replace unused `followers` prop with social proof * Introduce 'minimal' version * Gate social proof one explore page, fix space if no desc * Use smaller avis for minimal --------- Co-authored-by: Eric Bailey <git@esb.lol>
Diffstat (limited to 'src/components/KnownFollowers.tsx')
-rw-r--r-- | src/components/KnownFollowers.tsx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/components/KnownFollowers.tsx b/src/components/KnownFollowers.tsx index 7b861dc66..4017a7b0b 100644 --- a/src/components/KnownFollowers.tsx +++ b/src/components/KnownFollowers.tsx @@ -12,6 +12,7 @@ import {Link, LinkProps} from '#/components/Link' import {Text} from '#/components/Typography' const AVI_SIZE = 30 +const AVI_SIZE_SMALL = 20 const AVI_BORDER = 1 /** @@ -30,10 +31,12 @@ export function KnownFollowers({ profile, moderationOpts, onLinkPress, + minimal, }: { profile: AppBskyActorDefs.ProfileViewDetailed moderationOpts: ModerationOpts onLinkPress?: LinkProps['onPress'] + minimal?: boolean }) { const cache = React.useRef<Map<string, AppBskyActorDefs.KnownFollowers>>( new Map(), @@ -59,6 +62,7 @@ export function KnownFollowers({ cachedKnownFollowers={cachedKnownFollowers} moderationOpts={moderationOpts} onLinkPress={onLinkPress} + minimal={minimal} /> ) } @@ -71,11 +75,13 @@ function KnownFollowersInner({ moderationOpts, cachedKnownFollowers, onLinkPress, + minimal, }: { profile: AppBskyActorDefs.ProfileViewDetailed moderationOpts: ModerationOpts cachedKnownFollowers: AppBskyActorDefs.KnownFollowers onLinkPress?: LinkProps['onPress'] + minimal?: boolean }) { const t = useTheme() const {_} = useLingui() @@ -110,6 +116,8 @@ function KnownFollowersInner({ */ if (slice.length === 0) return null + const SIZE = minimal ? AVI_SIZE_SMALL : AVI_SIZE + return ( <Link label={_( @@ -120,7 +128,7 @@ function KnownFollowersInner({ style={[ a.flex_1, a.flex_row, - a.gap_md, + minimal ? a.gap_sm : a.gap_md, a.align_center, {marginLeft: -AVI_BORDER}, ]}> @@ -129,8 +137,8 @@ function KnownFollowersInner({ <View style={[ { - height: AVI_SIZE, - width: AVI_SIZE + (slice.length - 1) * a.gap_md.gap, + height: SIZE, + width: SIZE + (slice.length - 1) * a.gap_md.gap, }, pressed && { opacity: 0.5, @@ -145,14 +153,14 @@ function KnownFollowersInner({ { borderWidth: AVI_BORDER, borderColor: t.atoms.bg.backgroundColor, - width: AVI_SIZE + AVI_BORDER * 2, - height: AVI_SIZE + AVI_BORDER * 2, + width: SIZE + AVI_BORDER * 2, + height: SIZE + AVI_BORDER * 2, left: i * a.gap_md.gap, zIndex: AVI_BORDER - i, }, ]}> <UserAvatar - size={AVI_SIZE} + size={SIZE} avatar={prof.avatar} moderation={moderation.ui('avatar')} /> |