feat: 添加心情记录功能
在统计页面新增心情卡片和弹窗组件,支持用户记录和查看每日心情状态。
This commit is contained in:
76
components/MoodCard.tsx
Normal file
76
components/MoodCard.tsx
Normal file
@@ -0,0 +1,76 @@
|
||||
import React from 'react';
|
||||
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { ThemedText } from './ThemedText';
|
||||
import { ThemedView } from './ThemedView';
|
||||
|
||||
interface MoodCardProps {
|
||||
onPress: () => void;
|
||||
}
|
||||
|
||||
export function MoodCard({ onPress }: MoodCardProps) {
|
||||
return (
|
||||
<ThemedView style={styles.container}>
|
||||
<View style={styles.header}>
|
||||
<ThemedText style={styles.title}>心情</ThemedText>
|
||||
<ThemedText style={styles.subtitle}>记录你的每日心情</ThemedText>
|
||||
</View>
|
||||
|
||||
<TouchableOpacity style={styles.content} onPress={onPress}>
|
||||
<View style={styles.moodIcon}>
|
||||
<Text style={styles.emoji}>😊</Text>
|
||||
</View>
|
||||
<ThemedText style={styles.moodText}>点击记录今日心情</ThemedText>
|
||||
</TouchableOpacity>
|
||||
</ThemedView>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
backgroundColor: '#fff',
|
||||
borderRadius: 16,
|
||||
padding: 16,
|
||||
marginBottom: 16,
|
||||
shadowColor: '#000',
|
||||
shadowOffset: {
|
||||
width: 0,
|
||||
height: 2,
|
||||
},
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 3.84,
|
||||
elevation: 5,
|
||||
},
|
||||
header: {
|
||||
marginBottom: 12,
|
||||
},
|
||||
title: {
|
||||
fontSize: 18,
|
||||
fontWeight: '600',
|
||||
marginBottom: 4,
|
||||
},
|
||||
subtitle: {
|
||||
fontSize: 14,
|
||||
opacity: 0.6,
|
||||
},
|
||||
content: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
paddingVertical: 8,
|
||||
},
|
||||
moodIcon: {
|
||||
width: 40,
|
||||
height: 40,
|
||||
borderRadius: 20,
|
||||
backgroundColor: '#f0f0f0',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
marginRight: 12,
|
||||
},
|
||||
emoji: {
|
||||
fontSize: 20,
|
||||
},
|
||||
moodText: {
|
||||
fontSize: 16,
|
||||
flex: 1,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user