mirror of
https://github.com/mudabbir-ahmad/Project-MAD-crudler.git
synced 2026-10-07 20:40:20 +00:00
Made User Form section
This commit is contained in:
1 parent
d948f126df
commit
755d568090
8 files changed
+365
-61
No files matched your search
@@ -0,0 +1,74 @@
|
||||
import {Alert, StyleSheet, Text, View} from "react-native";
|
||||
import FullWidthImage from "react-native-fullwidth-image";
|
||||
import {Button, ButtonTray} from "../../UI/Button";
|
||||
import Icons from "../../UI/Icons.js"
|
||||
|
||||
const UserView = ({module, onDelete, onModify}) => {
|
||||
// Initialisation -------------
|
||||
// State ----------------------
|
||||
// Handlers -------------------
|
||||
|
||||
const handleDelete = () => onDelete(module);
|
||||
|
||||
const requestDelete = () => {
|
||||
Alert.alert(
|
||||
'Delete Warning',
|
||||
`Are you sure you want to delete module ${module.ModuleCode} ${module.ModuleName}?`,
|
||||
[
|
||||
{text: 'cancel'},
|
||||
{text: 'Delete', onPress: handleDelete}
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// View -----------------------
|
||||
|
||||
return (<View style={styles.container}>
|
||||
<FullWidthImage source={{uri: module.ModuleImageURL}} style={styles.image}/>
|
||||
|
||||
<View style={styles.infoTray}>
|
||||
<Text style={styles.boldText}>View {module.ModuleCode} {module.ModuleName}</Text>
|
||||
<Text style={styles.text}>Level {module.ModuleLevel}</Text>
|
||||
<Text style={styles.text}>cohort {module.ModuleYearID}</Text>
|
||||
<Text style={styles.Text}>
|
||||
{module.ModuleLeaderID} <Text style={styles.dimText}>(Module Leader)</Text>
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<ButtonTray>
|
||||
<Button
|
||||
icon={<Icons.Edit/>}
|
||||
label={"Modify"}
|
||||
onClick={onModify}
|
||||
/>
|
||||
<Button
|
||||
icon={<Icons.Delete/>}
|
||||
label={"Delete"}
|
||||
// styleButton={{backgroundColor: 'mistyrose'}}
|
||||
// styleLabel={{color: 'red'}}
|
||||
onClick={requestDelete}
|
||||
/>
|
||||
</ButtonTray>
|
||||
|
||||
</View>);
|
||||
};
|
||||
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
gap: 15,
|
||||
}, infoTray: {
|
||||
gap: 5,
|
||||
}, image: {
|
||||
borderRadius: 3,
|
||||
}, text: {
|
||||
fontSize: 16,
|
||||
}, boldText: {
|
||||
fontSize: 16, fontWeight: 'bold',
|
||||
}, dimText: {
|
||||
color: "grey",
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
export default UserView;
|
||||
Reference in new issue
Block a user