feat: 添加会话列表和搜索功能,重构聊天界面组件
This commit is contained in:
56
features/im/components/conversation-header.tsx
Normal file
56
features/im/components/conversation-header.tsx
Normal file
@@ -0,0 +1,56 @@
|
||||
import MaterialIcons from "@expo/vector-icons/MaterialIcons";
|
||||
import { Pressable, StyleSheet, Text, View } from "react-native";
|
||||
|
||||
type ConversationHeaderProps = {
|
||||
totalLabel: string;
|
||||
onPressCreate?: () => void;
|
||||
};
|
||||
|
||||
export function ConversationHeader({
|
||||
totalLabel,
|
||||
onPressCreate,
|
||||
}: ConversationHeaderProps) {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.sideSpacer} />
|
||||
<Text style={styles.title}>{`消息(${totalLabel})`}</Text>
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
onPress={onPressCreate}
|
||||
style={({ pressed }) => [styles.addButton, pressed && styles.addButtonPressed]}
|
||||
>
|
||||
<MaterialIcons color="#666666" name="add-circle-outline" size={36} />
|
||||
</Pressable>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
alignItems: "center",
|
||||
flexDirection: "row",
|
||||
height: 52,
|
||||
justifyContent: "space-between",
|
||||
paddingHorizontal: 20,
|
||||
},
|
||||
sideSpacer: {
|
||||
width: 36,
|
||||
},
|
||||
title: {
|
||||
color: "#242424",
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
letterSpacing: -0.2,
|
||||
},
|
||||
addButton: {
|
||||
alignItems: "center",
|
||||
borderCurve: "continuous",
|
||||
borderRadius: 18,
|
||||
height: 36,
|
||||
justifyContent: "center",
|
||||
width: 36,
|
||||
},
|
||||
addButtonPressed: {
|
||||
opacity: 0.7,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user