1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
import React from 'react'
import {StyleSheet, TouchableOpacity, View} from 'react-native'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {Text} from '../util/text/Text'
import {usePalette} from '../../lib/hooks/usePalette'
export function ComposePrompt({
text = "What's up?",
btn = 'Post',
isReply = false,
onPressCompose,
}: {
text?: string
btn?: string
isReply?: boolean
onPressCompose: (imagesOpen?: boolean) => void
}) {
const pal = usePalette('default')
return (
<TouchableOpacity
testID="composePromptButton"
style={[
pal.view,
pal.border,
styles.container,
isReply ? styles.containerReply : undefined,
]}
onPress={() => onPressCompose()}>
{!isReply && (
<FontAwesomeIcon
icon={['fas', 'pen-nib']}
size={18}
style={[pal.textLight, styles.iconLeft]}
/>
)}
<View style={styles.textContainer}>
<Text type={isReply ? 'lg' : 'lg-medium'} style={pal.textLight}>
{text}
</Text>
</View>
{isReply ? (
<View
style={[styles.btn, {backgroundColor: pal.colors.backgroundLight}]}>
<Text type="button" style={pal.textLight}>
{btn}
</Text>
</View>
) : (
<TouchableOpacity onPress={() => onPressCompose(true)}>
<FontAwesomeIcon
icon={['far', 'image']}
size={18}
style={[pal.textLight, styles.iconRight]}
/>
</TouchableOpacity>
)}
</TouchableOpacity>
)
}
const styles = StyleSheet.create({
iconLeft: {
marginLeft: 22,
marginRight: 2,
},
iconRight: {
marginRight: 20,
},
container: {
paddingVertical: 16,
flexDirection: 'row',
alignItems: 'center',
borderTopWidth: 1,
},
containerReply: {
paddingVertical: 14,
paddingHorizontal: 10,
},
avatar: {
width: 50,
},
textContainer: {
marginLeft: 10,
flex: 1,
},
btn: {
paddingVertical: 6,
paddingHorizontal: 14,
borderRadius: 30,
},
})
|