diff --git a/src/components/entity/modules/ModuleItem.js b/src/components/entity/modules/ModuleItem.js new file mode 100644 index 0000000..77dec32 --- /dev/null +++ b/src/components/entity/modules/ModuleItem.js @@ -0,0 +1,32 @@ +import {StyleSheet, Text, View, Pressable} from "react-native"; + +const ModuleItem = ({module, onSelect }) => { + // Initialisation ------------- + // State ---------------------- + // Handlers ------------------- + // View ----------------------- + + return( + onSelect(module)}> + + + {module.ModuleCode} {module.ModuleName} + + + + ); +}; + + +const styles = StyleSheet.create({ + modulesItem: { + paddingVertical: 15, + borderBottomWidth: 1, + borderBottomColor: "light grey", + }, + text: { + // fontSize: 16, + }, +}); + +export default ModuleItem; \ No newline at end of file diff --git a/src/components/entity/modules/ModuleList.js b/src/components/entity/modules/ModuleList.js new file mode 100644 index 0000000..5524ebf --- /dev/null +++ b/src/components/entity/modules/ModuleList.js @@ -0,0 +1,31 @@ +import {StyleSheet, ScrollView } from "react-native"; +import modules from "../../../data/modules"; +import ModuleItem from "./ModuleItem"; +import React from "react"; + +const ModuleList = ({module, onSelect }) => { + // Initialisation ------------- + // State ---------------------- + // Handlers ------------------- + // View ----------------------- + + return( + + {modules.map((module) => { + return( + + ) + }) + } + + ); +}; + + +const styles = StyleSheet.create({ + modulesContainer: { + + }, +}); + +export default ModuleList; \ No newline at end of file diff --git a/src/components/screens/ModuleListScreen.js b/src/components/screens/ModuleListScreen.js index e201f43..5c09745 100644 --- a/src/components/screens/ModuleListScreen.js +++ b/src/components/screens/ModuleListScreen.js @@ -1,7 +1,8 @@ -import {StyleSheet, Text, ScrollView, View, Pressable} from "react-native"; -import Screen from "../layout/Screen"; +import {StyleSheet } from "react-native"; +import Screen from "../layout/Screen"; import initialModules from "../../data/modules.js"; +import ModuleList from "../entity/modules/ModuleList"; export const ModuleListScreen = () => { @@ -10,42 +11,19 @@ export const ModuleListScreen = () => { // State ---------------------- // Handlers ------------------- - const handleSelect = () => alert("Item selected"); + const handleSelect = (module) => alert(`Item ${module.ModuleName} selected`); // View ----------------------- + return ( - - {modules.map((module) => { - return( - - - - {module.ModuleCode} {module.ModuleName} - - - - ) - }) - } - + ); }; -const styles = StyleSheet.create({ - modulesContainer: { - marginTop: 20, - }, - modulesItem: { - padding: 15, - marginBottom: 10, - borderTopWidth: 1, - borderTopColor: "light grey", - // borderRadius: 15, - }, - text: { - }, -}); +const styles = StyleSheet.create({}); + +export default ModuleListScreen; + -export default ModuleListScreen; \ No newline at end of file