tooot/src/screens/Shared/Account/Information/Account.tsx

65 lines
1.8 KiB
TypeScript
Raw Normal View History

2020-12-27 16:25:29 +01:00
import { Feather } from '@expo/vector-icons'
import { StyleConstants } from '@root/utils/styles/constants'
import { useTheme } from '@root/utils/styles/ThemeManager'
import { LinearGradient } from 'expo-linear-gradient'
import React, { forwardRef } from 'react'
import { StyleSheet, Text, View } from 'react-native'
import ShimmerPlaceholder, {
createShimmerPlaceholder
} from 'react-native-shimmer-placeholder'
export interface Props {
account: Mastodon.Account | undefined
}
const AccountInformationAccount = forwardRef<ShimmerPlaceholder, Props>(
({ account }, ref) => {
const { theme } = useTheme()
const ShimmerPlaceholder = createShimmerPlaceholder(LinearGradient)
return (
<ShimmerPlaceholder
ref={ref}
visible={account?.acct !== undefined}
width={StyleConstants.Font.Size.M * 8}
height={StyleConstants.Font.Size.M}
style={{ marginBottom: StyleConstants.Spacing.L }}
shimmerColors={theme.shimmer}
>
<View style={styles.account}>
<Text
style={{
color: theme.secondary,
...StyleConstants.FontStyle.M
2020-12-27 16:25:29 +01:00
}}
selectable
>
@{account?.acct}
</Text>
{account?.locked ? (
2020-12-27 16:25:29 +01:00
<Feather name='lock' style={styles.type} color={theme.secondary} />
) : null}
{account?.bot ? (
2020-12-27 16:25:29 +01:00
<Feather
name='hard-drive'
style={styles.type}
color={theme.secondary}
/>
) : null}
2020-12-27 16:25:29 +01:00
</View>
</ShimmerPlaceholder>
)
}
)
const styles = StyleSheet.create({
account: {
flexDirection: 'row',
alignItems: 'center'
},
type: { marginLeft: StyleConstants.Spacing.S }
})
export default AccountInformationAccount