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