Skip to content
Snippets Groups Projects

Feature/load studentcities after review

Merged Jørgen Rosager requested to merge feature/load-studentcities-after-review into master
25 files
+ 344
533
Compare changes
  • Side-by-side
  • Inline
Files
25
import React from "react";
import { StudentCity } from "../../store/studentCities/interfaces";
import { StudentCity } from "../../store/studentCity/interfaces";
import { Text, View } from "../Themed";
import { Card, Badge } from "react-native-elements";
import { Badge } from "react-native-elements";
import { useActions } from "../../hooks/useActions";
import { setCurrentStudentCity } from "../../store/currentStudentCity/actions";
import { setStudentCity } from "../../store/studentCity/actions";
import { TouchableOpacity } from "react-native-gesture-handler";
import Rating from "../Rating";
import StarRating from "../Rating/StarRating";
@@ -17,16 +17,14 @@ type Props = {
* Component for showing data for one student city given as a prop.
*/
const StudentCityCard = ({ studentCity, navigation }: Props) => {
const [showDetails, setShowDetails] = React.useState(false);
const actions = useActions({ setCurrentStudentCity });
const actions = useActions({ setStudentCity });
return (
<TouchableOpacity
key={studentCity.id}
onPress={() => {
//console.log("cities: ", studentCities.data);
actions.setCurrentStudentCity(studentCity);
navigation.navigate("StudentCity", {});
actions.setStudentCity(studentCity); // don't need to fetch again here
navigation.navigate("StudentCity");
}}
>
<View
@@ -38,7 +36,7 @@ const StudentCityCard = ({ studentCity, navigation }: Props) => {
backgroundColor: "#4A5568",
borderColor: "#4A5568",
borderRadius: 5,
paddingVertical: 20
paddingVertical: 20,
}}
>
<View
@@ -46,7 +44,7 @@ const StudentCityCard = ({ studentCity, navigation }: Props) => {
flex: 1,
flexDirection: "row",
justifyContent: "center",
backgroundColor: "#4A5568"
backgroundColor: "#4A5568",
}}
>
<Text style={{ color: "white", fontSize: 23 }}>
@@ -58,14 +56,14 @@ const StudentCityCard = ({ studentCity, navigation }: Props) => {
flex: 1,
flexDirection: "row",
padding: 9,
backgroundColor: "#4A5568"
backgroundColor: "#4A5568",
}}
>
<Badge
value={studentCity.byNavn}
badgeStyle={{
backgroundColor: "#319795",
borderColor: "#1D4044"
borderColor: "#1D4044",
}}
textStyle={{ fontSize: 15 }}
/>
Loading