-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChatHeader.tsx
More file actions
83 lines (79 loc) · 2.05 KB
/
ChatHeader.tsx
File metadata and controls
83 lines (79 loc) · 2.05 KB
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
import React from 'react';
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { MaterialIcons } from '@expo/vector-icons';
import { ChatHeaderProps } from './types';
const ChatHeader: React.FC<ChatHeaderProps> = ({
modelType,
onModelChange,
onNewChat,
style
}) => {
const insets = useSafeAreaInsets();
return (
<View style={[styles.header, { paddingTop: insets.top + 5 }, style]}>
<View style={styles.actions}>
<TouchableOpacity
style={styles.modelSelector}
onPress={() => onModelChange(modelType === 'base' ? 'advanced' : 'base')}
>
<MaterialIcons name="insights" size={18} color="#5B37B7" />
<Text style={styles.modelText}>
{modelType === 'advanced' ? 'Avanzato' : 'Base'}
</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.newChatButton}
onPress={onNewChat}
>
<MaterialIcons name="add" size={20} color="#5B37B7" />
</TouchableOpacity>
</View>
</View>
);
};
const styles = StyleSheet.create({
header: {
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-end",
width: "100%",
padding: 8,
paddingTop: 15,
paddingBottom: 8,
backgroundColor: "#FFFFFF",
shadowColor: "#000",
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.08,
shadowRadius: 2,
elevation: 2,
},
actions: {
flexDirection: 'row',
alignItems: 'center',
},
modelSelector: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: '#F0EAFA',
paddingHorizontal: 10,
paddingVertical: 4,
borderRadius: 14,
marginRight: 8,
},
modelText: {
fontSize: 13,
color: '#5B37B7',
marginLeft: 4,
fontWeight: '500',
},
newChatButton: {
width: 30,
height: 30,
borderRadius: 15,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F0EAFA',
}
});
export default ChatHeader;