Skip to content

Commit 0d856ef

Browse files
authored
manually committing files before final check
0 parents  commit 0d856ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+8513
-0
lines changed

Diff for: App.js

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import React, { useState } from "react";
2+
import { View, Text } from "react-native";
3+
import { MaterialCommunityIcons } from "react-native-vector-icons";
4+
import { NavigationContainer, useNavigation } from "@react-navigation/native";
5+
import { createNativeStackNavigator } from "@react-navigation/native-stack";
6+
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
7+
import TabNavigator from "./tabs/TabNavigator";
8+
import Header from "./components/Header";
9+
import * as constants from "./utils/constants";
10+
import HomeScreen from "./screens/HomeScreen";
11+
import ConsultScreen from "./screens/ConsultScreen";
12+
import ProfileScreen from "./screens/ProfileScreen";
13+
14+
15+
const Tab = createBottomTabNavigator();
16+
const Stack = createNativeStackNavigator();
17+
18+
export default function App({navigation}) {
19+
20+
const [item, setItem] = useState("");
21+
22+
function assignItem(selected) {
23+
24+
setItem(selected);
25+
26+
}
27+
28+
const homeScreenSettings = {
29+
30+
tabBarLabel: ({ focused }) => <Text style={{color: focused ? constants.highlightBlue : "#000", fontSize: 10 }}>Home</Text>,
31+
tabBarIcon: ({ focused }) => <MaterialCommunityIcons color={focused ? constants.highlightBlue : "#000"} name="home" size={25} />
32+
};
33+
34+
const ConsultScreenSettings = {
35+
36+
tabBarBadge: 0,
37+
tabBarBadgeStyle: { backgroundColor: constants.statusPink },
38+
tabBarLabel: ({ focused }) => <Text style={{color: focused ? constants.highlightBlue : "#000", fontSize: 10 }}>Consults</Text>,
39+
tabBarIcon: ({ focused }) => <MaterialCommunityIcons color={focused ? constants.highlightBlue : "#000"} name="message-reply" size={25} />
40+
};
41+
42+
const ordersScreenSettings = {
43+
44+
tabBarBadge: 0,
45+
tabBarBadgeStyle: { backgroundColor: constants.statusPink },
46+
tabBarLabel: ({ focused }) => <Text style={{color: focused ? constants.highlightBlue : "#000", fontSize: 10 }}>Orders</Text>,
47+
headerTitle: () => <Header itemHandler={assignItem} />,
48+
tabBarIcon: ({ focused }) => <MaterialCommunityIcons color={focused ? constants.highlightBlue : "#000"} name="cart" size={25} />
49+
};
50+
51+
const profileScreenSettings = {
52+
53+
tabBarLabel: ({ focused }) => <Text style={{color: focused ? constants.highlightBlue : "#000", fontSize: 10 }}>Profile</Text>,
54+
tabBarIcon: ({ focused }) => <MaterialCommunityIcons color={focused ? constants.highlightBlue : "#000"} name="account-cog" size={25} />
55+
};
56+
57+
return (
58+
59+
<NavigationContainer>
60+
61+
<Tab.Navigator screenOptions={{ tabBarStyle: { paddingBottom: 2 } }}>
62+
63+
<Stack.Screen name="Home" component={HomeScreen} options={homeScreenSettings} />
64+
<Stack.Screen name="Consults" component={ConsultScreen} options={ConsultScreenSettings} />
65+
<Stack.Screen name="Orders" navigation={navigation} children={()=> <TabNavigator item={item} /> } options={ordersScreenSettings} />
66+
<Stack.Screen name="Profile" component={ProfileScreen} options={profileScreenSettings} />
67+
68+
</Tab.Navigator>
69+
70+
</NavigationContainer>
71+
72+
);
73+
74+
}

Diff for: README.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# HealthDart case
2+
## _May the odds be ever in your favour
3+
4+
The case below is designed to test your technical comprehension, technical ability, basic front end design and integration to API's.
5+
6+
You will need to build this app using react-native. To get started
7+
8+
- Download the codebase from GitHub
9+
- Get the shell app running on your machine
10+
- ✨Magic ✨
11+
12+
## Included
13+
14+
- This app is a container app which has react-navigation, react-native-vector icons and asset files
15+
- In the assets/svg folder exists the asset files needed for the project
16+
- In the assets/data folder exists the data file needed for the project
17+
- The icons for the bottom navigation bar can be sourced from vector-icons library
18+
19+
## To do
20+
- You will be required to integrate to the mock API/JSON file
21+
- Match the UI below as close as possible using:
22+
-- Vector Icons
23+
-- HealthDart asset files
24+
-- React-Navigation
25+
-- Header Tab switches
26+
27+
![Alt Text](UI.gif)
28+
29+
## Think about
30+
- Design and layout
31+
- Code reusability
32+
- Write code as if you are working in a large team of developers
33+
- code neatness
34+
- code management
35+
- problem solving
36+
- use programming constructs like loops, if statements, arrays if needed
37+
38+
## What we will look out for
39+
- We will check out your code for all the above mentioned and anything you do above and beyond the scope
40+
41+
## Installation
42+
43+
the case requires [Node.js](https://nodejs.org/) v14+ to run.
44+
45+
Install the dependencies and devDependencies and start the server.
46+
47+
```sh
48+
cd case
49+
yarn or npm install
50+
expo start --ios or expo start --android
51+
```

Diff for: Software_Desgn__project_study.pdf

753 KB
Binary file not shown.

Diff for: UI.gif

6.72 MB
Loading

Diff for: app.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"expo": {
3+
"name": "healthdart-case",
4+
"slug": "healthdart-case",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"splash": {
10+
"image": "./assets/splash.png",
11+
"resizeMode": "contain",
12+
"backgroundColor": "#ffffff"
13+
},
14+
"updates": {
15+
"fallbackToCacheTimeout": 0
16+
},
17+
"assetBundlePatterns": [
18+
"**/*"
19+
],
20+
"ios": {
21+
"supportsTablet": true
22+
},
23+
"android": {
24+
"adaptiveIcon": {
25+
"foregroundImage": "./assets/adaptive-icon.png",
26+
"backgroundColor": "#FFFFFF"
27+
}
28+
},
29+
"web": {
30+
"favicon": "./assets/favicon.png"
31+
}
32+
}
33+
}

Diff for: assets/adaptive-icon.png

17.1 KB
Loading

Diff for: assets/data/orders.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[
2+
{
3+
"orderID": 1,
4+
"orderStatus": "Cancelled",
5+
"pharmacyName": "Admin (avail. Mon-Sat, 9am-5pm)",
6+
"orderTotal": 107.32
7+
},
8+
{
9+
"orderID": 2,
10+
"orderStatus": "Submitted",
11+
"pharmacyName": "Selgo pharmacy & clinic",
12+
"orderTotal": 184.88
13+
},
14+
{
15+
"orderID": 3,
16+
"orderStatus": "Cancelled",
17+
"pharmacyName": "Protea Glen Family Pharmacy",
18+
"orderTotal": 355.37
19+
},
20+
{
21+
"orderID": 4,
22+
"orderStatus": "Out for delivery",
23+
"pharmacyName": "Admin (avail. Mon-Sat, 9am-5pm)",
24+
"orderTotal": 127.32
25+
},
26+
{
27+
"orderID": 5,
28+
"orderStatus": "Submitted",
29+
"pharmacyName": "Admin (avail. Mon-Sat, 9am-5pm)",
30+
"orderTotal": 37.32
31+
},
32+
{
33+
"orderID": 6,
34+
"orderStatus": "Cancelled",
35+
"pharmacyName": "Admin (avail. Mon-Sat, 9am-5pm)",
36+
"orderTotal": 127.32
37+
},
38+
{
39+
"orderID": 7,
40+
"orderStatus": "Delivered",
41+
"pharmacyName": "Admin (avail. Mon-Sat, 9am-5pm)",
42+
"orderTotal": 127.32
43+
}
44+
]

Diff for: assets/favicon.png

1.43 KB
Loading

Diff for: assets/fonts/Montserrat-Bold.ttf

194 KB
Binary file not shown.

Diff for: assets/fonts/Montserrat-Medium.ttf

194 KB
Binary file not shown.

Diff for: assets/fonts/Montserrat-Regular.ttf

194 KB
Binary file not shown.

Diff for: assets/fonts/Montserrat-SemiBold.ttf

194 KB
Binary file not shown.

Diff for: assets/icon.png

21.9 KB
Loading

Diff for: assets/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Logo from './svg/logo.svg';
2+
import BackArrow from './svg/back-arrow.svg';
3+
4+
export {
5+
Logo,
6+
BackArrow,
7+
}

Diff for: assets/splash.png

46.2 KB
Loading

Diff for: assets/svg/back-arrow.svg

+4
Loading

Diff for: assets/svg/fonts/Montserrat-Bold.ttf

194 KB
Binary file not shown.

Diff for: assets/svg/fonts/Montserrat-ExtraBold.ttf

194 KB
Binary file not shown.

Diff for: assets/svg/fonts/Montserrat-Medium.ttf

194 KB
Binary file not shown.

Diff for: assets/svg/fonts/Montserrat-Regular.ttf

194 KB
Binary file not shown.

Diff for: assets/svg/fonts/Montserrat-SemiBold.ttf

194 KB
Binary file not shown.

Diff for: assets/svg/fonts/Montserrat-Thin.ttf

193 KB
Binary file not shown.

Diff for: assets/svg/logo.svg

+5
Loading

Diff for: babel.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function(api) {
2+
api.cache(true);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
};
6+
};

Diff for: components/ArrowSvg.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from "react";
2+
import Svg, { Path } from "react-native-svg";
3+
4+
5+
export default function ArrowSvg(props) {
6+
7+
return (
8+
9+
<Svg width="40%" height="40%" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 11" {...props} >
10+
11+
<Path scale={1} d="M11.5 6a.5.5 0 0 0 0-1v1Zm-10 0h10V5h-10v1Z" fill="#281D3F" />
12+
<Path scale={1} d="M6 1 1 5.5 6 10" stroke="#281D3F" strokeLinecap="round" />
13+
14+
</Svg>
15+
16+
);
17+
18+
}

Diff for: components/Card.js

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import React from "react";
2+
import { View, Text, StyleSheet } from "react-native";
3+
import { MaterialCommunityIcons } from "react-native-vector-icons";
4+
import * as constants from "../utils/constants";
5+
6+
7+
export default function Card({status, pharmacy, cost}) {
8+
9+
return (
10+
11+
<View style={styles.cardContainer}>
12+
13+
<View style={styles.detailsContainer}>
14+
15+
<View style={styles.statusContainer}>
16+
17+
{ <View style={[styles.statusIndicator, { backgroundColor: status === "Submitted" ? constants.highlightBlue : constants.statusPink }]}></View> }
18+
<View><Text style={styles.statusText}>{status}</Text></View>
19+
20+
</View>
21+
22+
<View style={styles.pharmacyContainer}>
23+
24+
<Text style={styles.pharmacyText}>{pharmacy}</Text>
25+
26+
</View>
27+
28+
<View style={styles.amountContainer}>
29+
30+
<Text style={styles.amountText}>Sum total: R {cost}</Text>
31+
32+
</View>
33+
34+
</View>
35+
36+
<View style={styles.arrowContainer}>
37+
38+
<View><MaterialCommunityIcons name="chevron-right" size={25}/></View>
39+
40+
</View>
41+
42+
</View>
43+
44+
);
45+
46+
}
47+
48+
49+
50+
51+
const styles = StyleSheet.create({
52+
53+
cardContainer: {
54+
55+
flexDirection: "row",
56+
borderRadius: 5,
57+
width: "90%",
58+
minHeight: 80,
59+
backgroundColor: constants.selectedGrey,
60+
marginBottom: 10,
61+
justifyContent: "space-between",
62+
alignItems: "center",
63+
paddingLeft: 10,
64+
paddingTop: 5
65+
},
66+
67+
detailsContainer: {
68+
69+
flex: 5
70+
},
71+
72+
statusContainer: {
73+
74+
flex: 1,
75+
flexDirection: "row",
76+
alignItems: "center",
77+
paddingBottom: 5
78+
},
79+
80+
statusIndicator: {
81+
82+
height: 10,
83+
width: 10,
84+
borderRadius: 50,
85+
marginRight: 5
86+
},
87+
88+
statusText: {
89+
90+
},
91+
92+
pharmacyContainer: {
93+
94+
flex: 1,
95+
flexWrap: "wrap",
96+
},
97+
98+
pharmacyText: {
99+
100+
fontWeight: "bold",
101+
fontSize: 16
102+
},
103+
104+
amountContainer: {
105+
106+
flex: 1
107+
},
108+
109+
amountText: {
110+
111+
fontSize: 16
112+
},
113+
114+
arrowContainer: {
115+
116+
flex: 1,
117+
alignItems: "center",
118+
justifyContent: "center"
119+
}
120+
121+
});

0 commit comments

Comments
 (0)