mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import React from 'react'
2import {StyleSheet, View} from 'react-native'
3import {IconProp} from '@fortawesome/fontawesome-svg-core'
4import {
5 FontAwesomeIcon,
6 FontAwesomeIconStyle,
7} from '@fortawesome/react-native-fontawesome'
8
9import {usePalette} from '#/lib/hooks/usePalette'
10import {s} from '#/lib/styles'
11import {Button} from './forms/Button'
12import {Text} from './text/Text'
13
14interface Props {
15 testID?: string
16 icon: IconProp
17 message: string
18 buttonLabel: string
19 onPress: () => void
20}
21
22export function EmptyStateWithButton(props: Props) {
23 const pal = usePalette('default')
24 const palInverted = usePalette('inverted')
25
26 return (
27 <View testID={props.testID} style={styles.container}>
28 <View style={styles.iconContainer}>
29 <FontAwesomeIcon
30 icon={props.icon}
31 style={[styles.icon, pal.text]}
32 size={62}
33 />
34 </View>
35 <Text type="xl-medium" style={[s.textCenter, pal.text]}>
36 {props.message}
37 </Text>
38 <View style={styles.btns}>
39 <Button
40 testID={props.testID ? `${props.testID}-button` : undefined}
41 type="inverted"
42 style={styles.btn}
43 onPress={props.onPress}>
44 <FontAwesomeIcon
45 icon="plus"
46 style={palInverted.text as FontAwesomeIconStyle}
47 size={14}
48 />
49 <Text type="lg-medium" style={palInverted.text}>
50 {props.buttonLabel}
51 </Text>
52 </Button>
53 </View>
54 </View>
55 )
56}
57const styles = StyleSheet.create({
58 container: {
59 height: '100%',
60 paddingVertical: 40,
61 paddingHorizontal: 30,
62 },
63 iconContainer: {
64 marginBottom: 16,
65 },
66 icon: {
67 marginLeft: 'auto',
68 marginRight: 'auto',
69 },
70 btns: {
71 flexDirection: 'row',
72 justifyContent: 'center',
73 },
74 btn: {
75 gap: 10,
76 marginVertical: 20,
77 flexDirection: 'row',
78 alignItems: 'center',
79 paddingVertical: 14,
80 paddingHorizontal: 24,
81 borderRadius: 30,
82 },
83 notice: {
84 borderRadius: 12,
85 paddingHorizontal: 12,
86 paddingVertical: 10,
87 marginHorizontal: 30,
88 },
89})