Integrate profile listings into design system

zio/stable
Paul Frazee 2022-12-30 13:20:55 -06:00
parent 10f613475a
commit 9084e0e4a8
4 changed files with 30 additions and 25 deletions

View File

@ -3,26 +3,26 @@ import {StyleSheet, TouchableOpacity, View} from 'react-native'
import {Link} from '../util/Link' import {Link} from '../util/Link'
import {Text} from '../util/text/Text' import {Text} from '../util/text/Text'
import {UserAvatar} from '../util/UserAvatar' import {UserAvatar} from '../util/UserAvatar'
import {s, colors} from '../../lib/styles' import {s} from '../../lib/styles'
import {usePalette} from '../../lib/hooks/usePalette'
export function ProfileCard({ export function ProfileCard({
did,
handle, handle,
displayName, displayName,
avatar, avatar,
renderButton, renderButton,
onPressButton, onPressButton,
}: { }: {
did: string
handle: string handle: string
displayName?: string displayName?: string
avatar?: string avatar?: string
renderButton?: () => JSX.Element renderButton?: () => JSX.Element
onPressButton?: () => void onPressButton?: () => void
}) { }) {
const pal = usePalette('default')
return ( return (
<Link <Link
style={styles.outer} style={[styles.outer, pal.view, pal.border]}
href={`/profile/${handle}`} href={`/profile/${handle}`}
title={handle} title={handle}
noFeedback> noFeedback>
@ -36,16 +36,18 @@ export function ProfileCard({
/> />
</View> </View>
<View style={styles.layoutContent}> <View style={styles.layoutContent}>
<Text style={[s.f16, s.bold, s.black]} numberOfLines={1}> <Text style={[s.bold, pal.text]} numberOfLines={1}>
{displayName || handle} {displayName || handle}
</Text> </Text>
<Text style={[s.f15, s.gray5]} numberOfLines={1}> <Text type="body2" style={[pal.textLight]} numberOfLines={1}>
@{handle} @{handle}
</Text> </Text>
</View> </View>
{renderButton ? ( {renderButton ? (
<View style={styles.layoutButton}> <View style={styles.layoutButton}>
<TouchableOpacity onPress={onPressButton} style={styles.btn}> <TouchableOpacity
onPress={onPressButton}
style={[styles.btn, pal.btn]}>
{renderButton()} {renderButton()}
</TouchableOpacity> </TouchableOpacity>
</View> </View>
@ -57,9 +59,7 @@ export function ProfileCard({
const styles = StyleSheet.create({ const styles = StyleSheet.create({
outer: { outer: {
marginTop: 1, borderTopWidth: 1,
backgroundColor: colors.white,
borderRadius: 6,
}, },
layout: { layout: {
flexDirection: 'row', flexDirection: 'row',
@ -93,7 +93,6 @@ const styles = StyleSheet.create({
paddingVertical: 7, paddingVertical: 7,
paddingHorizontal: 14, paddingHorizontal: 14,
borderRadius: 50, borderRadius: 50,
backgroundColor: colors.gray1,
marginLeft: 6, marginLeft: 6,
}, },
}) })

View File

@ -11,6 +11,7 @@ import {ErrorMessage} from '../util/error/ErrorMessage'
import {UserAvatar} from '../util/UserAvatar' import {UserAvatar} from '../util/UserAvatar'
import {useStores} from '../../../state' import {useStores} from '../../../state'
import {s, colors} from '../../lib/styles' import {s, colors} from '../../lib/styles'
import {usePalette} from '../../lib/hooks/usePalette'
export const ProfileFollowers = observer(function ProfileFollowers({ export const ProfileFollowers = observer(function ProfileFollowers({
name, name,
@ -80,9 +81,10 @@ export const ProfileFollowers = observer(function ProfileFollowers({
}) })
const User = ({item}: {item: FollowerItem}) => { const User = ({item}: {item: FollowerItem}) => {
const pal = usePalette('default')
return ( return (
<Link <Link
style={styles.outer} style={[styles.outer, pal.view, pal.border]}
href={`/profile/${item.handle}`} href={`/profile/${item.handle}`}
title={item.handle} title={item.handle}
noFeedback> noFeedback>
@ -96,10 +98,12 @@ const User = ({item}: {item: FollowerItem}) => {
/> />
</View> </View>
<View style={styles.layoutContent}> <View style={styles.layoutContent}>
<Text style={[s.f15, s.bold, s.black]}> <Text style={[s.bold, pal.text]}>
{item.displayName || item.handle} {item.displayName || item.handle}
</Text> </Text>
<Text style={[s.f14, s.gray5]}>@{item.handle}</Text> <Text type="body2" style={[pal.textLight]}>
@{item.handle}
</Text>
</View> </View>
</View> </View>
</Link> </Link>
@ -108,8 +112,7 @@ const User = ({item}: {item: FollowerItem}) => {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
outer: { outer: {
marginTop: 1, borderTopWidth: 1,
backgroundColor: colors.white,
}, },
layout: { layout: {
flexDirection: 'row', flexDirection: 'row',

View File

@ -11,6 +11,7 @@ import {Text} from '../util/text/Text'
import {ErrorMessage} from '../util/error/ErrorMessage' import {ErrorMessage} from '../util/error/ErrorMessage'
import {UserAvatar} from '../util/UserAvatar' import {UserAvatar} from '../util/UserAvatar'
import {s, colors} from '../../lib/styles' import {s, colors} from '../../lib/styles'
import {usePalette} from '../../lib/hooks/usePalette'
export const ProfileFollows = observer(function ProfileFollows({ export const ProfileFollows = observer(function ProfileFollows({
name, name,
@ -80,9 +81,10 @@ export const ProfileFollows = observer(function ProfileFollows({
}) })
const User = ({item}: {item: FollowItem}) => { const User = ({item}: {item: FollowItem}) => {
const pal = usePalette('default')
return ( return (
<Link <Link
style={styles.outer} style={[styles.outer, pal.view, pal.border]}
href={`/profile/${item.handle}`} href={`/profile/${item.handle}`}
title={item.handle} title={item.handle}
noFeedback> noFeedback>
@ -96,10 +98,12 @@ const User = ({item}: {item: FollowItem}) => {
/> />
</View> </View>
<View style={styles.layoutContent}> <View style={styles.layoutContent}>
<Text style={[s.f15, s.bold, s.black]}> <Text style={[s.bold, pal.text]}>
{item.displayName || item.handle} {item.displayName || item.handle}
</Text> </Text>
<Text style={[s.f14, s.gray5]}>@{item.handle}</Text> <Text type="body2" style={pal.textLight}>
@{item.handle}
</Text>
</View> </View>
</View> </View>
</Link> </Link>
@ -108,8 +112,7 @@ const User = ({item}: {item: FollowItem}) => {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
outer: { outer: {
marginTop: 1, borderTopWidth: 1,
backgroundColor: colors.white,
}, },
layout: { layout: {
flexDirection: 'row', flexDirection: 'row',

View File

@ -74,13 +74,13 @@ export const ViewHeader = observer(function ViewHeader({
)} )}
</TouchableOpacity> </TouchableOpacity>
<View style={styles.titleContainer} pointerEvents="none"> <View style={styles.titleContainer} pointerEvents="none">
<Text type="h3" style={pal.text}> <Text type="h4" style={pal.text}>
{title} {title}
</Text> </Text>
{subtitle ? ( {subtitle ? (
<Text <Text
type="h4" type="h5"
style={[styles.subtitle, pal.textLight]} style={[styles.subtitle, pal.textLight, {fontWeight: 'normal'}]}
numberOfLines={1}> numberOfLines={1}>
{subtitle} {subtitle}
</Text> </Text>
@ -147,7 +147,7 @@ const styles = StyleSheet.create({
marginRight: 'auto', marginRight: 'auto',
}, },
subtitle: { subtitle: {
marginLeft: 6, marginLeft: 4,
maxWidth: 200, maxWidth: 200,
}, },