44 lines
961 B
TypeScript
44 lines
961 B
TypeScript
|
import React from 'react';
|
||
|
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
||
|
import { Task } from '../types/task';
|
||
|
|
||
|
interface TaskCardProps {
|
||
|
task: Task;
|
||
|
onPress: (id: string) => void;
|
||
|
}
|
||
|
|
||
|
const TaskCard: React.FC<TaskCardProps> = ({ task, onPress }) => {
|
||
|
return (
|
||
|
<TouchableOpacity style={styles.card} onPress={() => onPress(task.id)}>
|
||
|
<Text style={styles.title}>{task.name}</Text>
|
||
|
<Text style={styles.status}>状态: {task.status}</Text>
|
||
|
</TouchableOpacity>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
const styles = StyleSheet.create({
|
||
|
card: {
|
||
|
backgroundColor: '#fff',
|
||
|
borderRadius: 8,
|
||
|
padding: 16,
|
||
|
margin: 8,
|
||
|
width: '45%',
|
||
|
elevation: 3,
|
||
|
shadowColor: '#000',
|
||
|
shadowOffset: { width: 0, height: 2 },
|
||
|
shadowOpacity: 0.1,
|
||
|
shadowRadius: 2,
|
||
|
},
|
||
|
title: {
|
||
|
fontSize: 16,
|
||
|
fontWeight: 'bold',
|
||
|
marginBottom: 8,
|
||
|
},
|
||
|
status: {
|
||
|
fontSize: 14,
|
||
|
color: '#666',
|
||
|
},
|
||
|
});
|
||
|
|
||
|
export default TaskCard;
|