mirror of
https://github.com/mudabbir-ahmad/Project-MAD-crudler.git
synced 2026-10-07 20:40:20 +00:00
Module View added, with images and moved view into reusable component for ModuleView. All activities done for week 2.
This commit is contained in:
1 parent
c18a531a9c
commit
2eacee759a
11 files changed
+120
-74
No files matched your search
@@ -1,12 +1,12 @@
|
||||
import {StyleSheet, Text, View, Pressable} from "react-native";
|
||||
|
||||
const ModuleItem = ({module, onSelect }) => {
|
||||
const ModuleItem = ({module, onSelect}) => {
|
||||
// Initialisation -------------
|
||||
// State ----------------------
|
||||
// Handlers -------------------
|
||||
// View -----------------------
|
||||
|
||||
return(
|
||||
return (
|
||||
<Pressable key={module.ModuleCode} onPress={() => onSelect(module)}>
|
||||
<View style={styles.modulesItem}>
|
||||
<Text style={styles.text}>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import {StyleSheet, ScrollView } from "react-native";
|
||||
import {StyleSheet, ScrollView} from "react-native";
|
||||
import ModuleItem from "./ModuleItem";
|
||||
import React from "react";
|
||||
|
||||
const ModuleList = ({modules, onSelect }) => {
|
||||
const ModuleList = ({modules, onSelect}) => {
|
||||
// Initialisation -------------
|
||||
// State ----------------------
|
||||
// Handlers -------------------
|
||||
// View -----------------------
|
||||
|
||||
return(
|
||||
return (
|
||||
<ScrollView style={styles.modulesContainer}>
|
||||
{modules.map((module) => {
|
||||
return(
|
||||
return (
|
||||
<ModuleItem
|
||||
module={module}
|
||||
key={module.ModuleCode}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import {StyleSheet, Text, View } from "react-native";
|
||||
import FullWidthImage from "react-native-fullwidth-image";
|
||||
|
||||
const ModuleView = ({module}) => {
|
||||
// Initialisation -------------
|
||||
// State ----------------------
|
||||
// Handlers -------------------
|
||||
// View -----------------------
|
||||
|
||||
return (<View style={styles.container}>
|
||||
<FullWidthImage source={{uri: module.ModuleImage}} 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}>
|
||||
{module.ModuleLeaderName} <Text style={styles.dimText}>(Module Leader)</Text>
|
||||
</Text>
|
||||
|
||||
</View>
|
||||
</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 ModuleView;
|
||||
Reference in new issue
Block a user