-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathStatusAlert.js
71 lines (65 loc) · 1.56 KB
/
StatusAlert.js
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
import React, {Component} from 'react';
import colors from 'assets/colors';
import PropTypes from 'prop-types';
import CustomIcon from 'assets/icons/CustomIcon.js';
import {StyleSheet, Text, View} from 'react-native';
class StatusAlert extends Component {
componentDidMount() {
setTimeout(() => {
this.props.showAlertCallback();
}, 3000);
}
render() {
const {status, text} = this.props;
const containerClass = status === 'success'
? styles.success_container
: styles.failure_container;
return (
<View style={[styles.container, containerClass]}>
{status === 'success' ? (
<CustomIcon
name={'checkmark24'}
color={colors.gray_icon}
size={24}
style={styles.icon}
/>
) : (
<CustomIcon
name={'close24'}
color={colors.gray_icon}
size={24}
style={styles.icon}
/>
)}
<Text style={styles.content}>{text}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
paddingVertical: 16,
paddingHorizontal: 27,
},
success_container: {
backgroundColor: '#CEF0CD',
},
failure_container: {
backgroundColor: colors.card_border,
},
icon: {
paddingRight: 5,
},
content: {
fontWeight: '500',
fontSize: 14,
lineHeight: 16,
},
});
StatusAlert.propTypes = {
status: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
};
export default StatusAlert;