mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Transform into TypeScript
This commit is contained in:
70
src/components/Toot/Actions.tsx
Normal file
70
src/components/Toot/Actions.tsx
Normal file
@ -0,0 +1,70 @@
|
||||
import React from 'react'
|
||||
import { Pressable, StyleSheet, Text, View } from 'react-native'
|
||||
import { Feather } from '@expo/vector-icons'
|
||||
|
||||
import action from 'src/components/action'
|
||||
|
||||
export interface Props {
|
||||
id: string
|
||||
replies_count: number
|
||||
reblogs_count: number
|
||||
reblogged?: boolean
|
||||
favourites_count: number
|
||||
favourited?: boolean
|
||||
}
|
||||
|
||||
const Actions: React.FC<Props> = ({
|
||||
id,
|
||||
replies_count,
|
||||
reblogs_count,
|
||||
reblogged,
|
||||
favourites_count,
|
||||
favourited
|
||||
}) => {
|
||||
return (
|
||||
<View style={styles.actions}>
|
||||
<Pressable style={styles.action}>
|
||||
<Feather name='message-circle' />
|
||||
<Text>{replies_count}</Text>
|
||||
</Pressable>
|
||||
<Pressable style={styles.action}>
|
||||
<Feather name='repeat' />
|
||||
<Text>{reblogs_count}</Text>
|
||||
</Pressable>
|
||||
<Pressable
|
||||
style={styles.action}
|
||||
onPress={() =>
|
||||
action({
|
||||
id,
|
||||
type: 'favourite',
|
||||
stateKey: 'favourited',
|
||||
statePrev: favourited || false
|
||||
})
|
||||
}
|
||||
>
|
||||
<Feather name='heart' />
|
||||
<Text>{favourites_count}</Text>
|
||||
</Pressable>
|
||||
<Pressable style={styles.action}>
|
||||
<Feather name='share' />
|
||||
</Pressable>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
actions: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
marginTop: 4
|
||||
},
|
||||
action: {
|
||||
width: '25%',
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'center',
|
||||
paddingTop: 8,
|
||||
paddingBottom: 8
|
||||
}
|
||||
})
|
||||
|
||||
export default Actions
|
Reference in New Issue
Block a user