Skip to content

Commit d23adde

Browse files
authored
Fix: Doctor search and filter screens styling (#55)
What does this PR do? This Pr fixes some designs that were not responsive on all devices and also add the modal to open when someone clicks on the filter icon on the search input **Tasks to be completed** - [x] Fix the modal component to be responsive in all devices as in some it was somehow not fitting the screen as intended - [x] change the position where someone has to click to open the filter modal How to test this manually click on the fix filter modal on the first screen that appears and you will be directed to the doctors found and click on the filter icon to open the modal
2 parents d0a41ec + c84b6b1 commit d23adde

File tree

9 files changed

+208
-497
lines changed

9 files changed

+208
-497
lines changed

app/(tabs)/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ const Home = () => {
116116
<Text className="text-[20px] font-['UrbanistBold']">Top Doctors</Text>
117117
<TouchableOpacity activeOpacity={0.8}>
118118

119-
<Text className="text-[16px] font-['Urbanist-Bold'] text-primary-500" onPress={() => {
120-
router.push("/Doctors/topDoctors");
121-
}}>
122-
See All
123-
</Text>
124-
</TouchableOpacity>
119+
<Text className="text-[16px] font-['UrbanistBold'] text-lightblue" onPress={() => {
120+
router.push("/Doctors/topDoctors");
121+
}}>
122+
See All
123+
</Text>
124+
</TouchableOpacity>
125125
</View>
126126
<FlatList
127127
data={roleFilters}

app/Doctors/doctorsFound.tsx

Lines changed: 7 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
11

22
import DoctorCard from "../../components/cards/doctCard";
33
import { NavigationHeader } from "@/components/NavigationHeader";
4-
import { router } from "expo-router";
54
import { StatusBar } from "expo-status-bar";
65
import DocButton from "../../components/cards/DocButtons";
7-
import ReviewButtons from "../../components/cards/ReviewButtons";
86
import React, { useState } from "react";
9-
import { StyleSheet, View, Image, TouchableOpacity, Text, ScrollView, Modal } from "react-native";
10-
import { useFonts } from "expo-font";
7+
import { View, Image, Text, ScrollView } from "react-native";
118
import { SearchInput } from "../../components/searchinput2";
12-
139
export default function DoctorDetails() {
14-
const [isVisible, setIsVisible] = useState(false);
1510
const [selectedCategory, setSelectedCategory] = useState("all");
16-
const toggleModal = () => {
17-
setIsVisible(!isVisible);
18-
}
19-
let [fontsLoaded] = useFonts({
20-
UrbanistBold: require("../../assets/fonts/Urbanist-Bold.ttf"),
21-
UrbanistMedium: require("../../assets/fonts/Urbanist-Regular.ttf"),
22-
UrbanistSemiBold: require("../../assets/fonts/Urbanist-SemiBold.ttf"),
23-
UrbanistRegular: require("../../assets/fonts/Urbanist-Regular.ttf"),
24-
});
25-
if (!fontsLoaded) {
26-
return null;
27-
}
2811
const docCards = [
2912
{
3013
name: "Dr. Randy Wigham",
@@ -51,7 +34,7 @@ export default function DoctorDetails() {
5134
image: require("../../assets/doctors/like.png"),
5235
stars: "4.8",
5336
reviews: "6,362",
54-
images: require("../../assets/doctors/doc1.png"),
37+
images: require("../../assets/doctors/doc2.png"),
5538
},
5639
{
5740
name: "Dr. Elijah Baranick",
@@ -79,182 +62,30 @@ export default function DoctorDetails() {
7962

8063

8164
return (
82-
<View style={styles.mainContainer}>
65+
<View className="flex-1 bg-white">
8366
<ScrollView showsVerticalScrollIndicator={false}>
8467
<View className="flex-1 bg-white px-4 py-5">
8568
<View className="pt-10">
8669

87-
<View className="flex-row">
70+
<View className="flex-row justify-around">
8871
<NavigationHeader title="" />
8972
<SearchInput />
9073
</View>
9174

9275
<DocButton selectedCategory={selectedCategory} onCategorySelect={setSelectedCategory} />
9376
</View>
94-
<View style={styles.found}>
95-
<Text style={styles.btnTxt}>489 founds</Text>
77+
<View className="px-[10px] my-[15px] flex-row justify-between">
78+
<Text className="text-[#212121] text-[20px] font-UrbanistRegular">489 founds</Text>
9679
<View className="flex-row">
97-
<Text style={styles.default} onPress={toggleModal}>Default </Text>
80+
<Text className="text-[#246BFD] text-[16px] font-UrbanistRegular">Default </Text>
9881
<Image source={require("../../assets/doctors/arrows.png")} />
9982
</View>
10083
</View>
10184
{filteredDocCards.map((spot, index) => (
10285
<DoctorCard key={index} {...spot} />
10386
))}
104-
105-
<Modal
106-
visible={isVisible}
107-
animationType="fade"
108-
transparent={true}
109-
onRequestClose={toggleModal}
110-
>
111-
<View style={{ flex: 1, justifyContent: 'flex-end', alignItems: 'flex-end', backgroundColor: 'rgba(0,0,0,0.5)' }}>
112-
<View style={{ backgroundColor: 'white', borderTopRightRadius: 48, borderTopLeftRadius: 48 }}>
113-
<Text style={styles.title2}>Filter</Text>
114-
<Text style={styles.line}></Text>
115-
<View>
116-
<Text style={styles.subtitles}>Speciality
117-
</Text>
118-
<DocButton selectedCategory={selectedCategory} onCategorySelect={setSelectedCategory} />
119-
<Text style={styles.subtitles}>Rating
120-
</Text>
121-
<ReviewButtons />
122-
<Text style={styles.line}></Text>
123-
</View>
124-
<View style={styles.btns}>
125-
<TouchableOpacity style={styles.regularBn} onPress={() => {
126-
setIsVisible(false)
127-
}}>
128-
<Text style={styles.buttonText}>Reset</Text>
129-
</TouchableOpacity>
130-
<TouchableOpacity style={styles.activeBn} onPress={() => {
131-
setIsVisible(false)
132-
}}>
133-
<Text style={styles.activeTxt}>Apply</Text>
134-
</TouchableOpacity>
135-
136-
137-
</View>
138-
</View>
139-
</View>
140-
</Modal>
14187
</View>
14288
</ScrollView>
14389
</View>
14490
)
14591
}
146-
const styles = StyleSheet.create({
147-
mainContainer: {
148-
flex: 1,
149-
backgroundColor: "white",
150-
},
151-
activeBtn: {
152-
backgroundColor: "#246BFD",
153-
paddingVertical: 8,
154-
paddingHorizontal: 20,
155-
borderRadius: 100,
156-
},
157-
activeText: {
158-
color: "#FFFFFF",
159-
fontFamily: "UrbanistRegular"
160-
},
161-
btns: {
162-
flexDirection: "row",
163-
justifyContent: "space-between",
164-
margin: 10,
165-
166-
},
167-
title: {
168-
textAlign: "center",
169-
fontSize: 24,
170-
fontFamily: "UrbanistBold"
171-
},
172-
173-
btnText: {
174-
color: "#246BFD",
175-
},
176-
images: {
177-
width: 28,
178-
height: 28,
179-
marginHorizontal: 10,
180-
marginTop: 15,
181-
},
182-
title2: {
183-
fontSize: 24,
184-
color: "#212121",
185-
textAlign: "center",
186-
fontFamily: "UrbanistBold",
187-
marginVertical: 10,
188-
},
189-
found: {
190-
paddingHorizontal: 10,
191-
marginVertical: 15,
192-
flexDirection: "row",
193-
justifyContent: "space-between",
194-
},
195-
default: {
196-
color: "#246BFD",
197-
fontSize: 16,
198-
fontFamily: "UrbanistRegular"
199-
},
200-
titleResult: {
201-
fontSize: 24,
202-
paddingVertical: 15,
203-
},
204-
activeBn: {
205-
backgroundColor: "#246BFD",
206-
width: 184,
207-
height: 58,
208-
paddingHorizontal: 18,
209-
paddingVertical: 16,
210-
borderRadius: 100,
211-
},
212-
activeTxt: {
213-
color: "#FFFFFF",
214-
textAlign: "center",
215-
fontFamily: "UrbanistBold",
216-
fontSize: 16,
217-
},
218-
regularBn: {
219-
backgroundColor: "#E9F0FF",
220-
width: 184,
221-
height: 58,
222-
paddingVertical: 18,
223-
paddingHorizontal: 16,
224-
borderRadius: 100,
225-
marginHorizontal: 1,
226-
},
227-
line: {
228-
marginVertical: 15,
229-
borderWidth: 0.3,
230-
paddingHorizontal: 50,
231-
height: 0,
232-
backgroundColor: "#EEEEEE",
233-
opacity: 0.1,
234-
},
235-
buttonText: {
236-
color: "#246BFD",
237-
textAlign: "center",
238-
fontFamily: "UrbanistBold",
239-
fontSize: 16,
240-
},
241-
buttons: {
242-
flexDirection: "row",
243-
justifyContent: "space-between",
244-
marginVertical: 10,
245-
marginHorizontal: 15,
246-
},
247-
subtitles: {
248-
color: "#212121",
249-
fontSize: 18,
250-
marginVertical: 15,
251-
marginLeft: 20,
252-
fontFamily: "UrbanistBold"
253-
},
254-
btnTxt: {
255-
color: "#212121",
256-
fontSize: 20,
257-
fontFamily: "UrbanistRegular"
258-
259-
}
260-
});

app/Doctors/favoriteDoctors.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import DocButton from "@/components/cards/DocButtons";
55
import { Icon } from "@/components/Icon";
66
import React, { useState } from "react";
77

8-
import { StyleSheet, View, Image, ScrollView, TouchableOpacity, Text, ImageSourcePropType, Modal } from "react-native";
8+
import { StyleSheet, View, Image, ScrollView, TouchableOpacity, TouchableWithoutFeedback,Text, ImageSourcePropType, Modal } from "react-native";
99
type cardSpot = {
1010
name: string;
1111
role: string;
@@ -24,15 +24,6 @@ export default function DoctorDetails() {
2424
setIsVisible(!isVisible);
2525
setSelectedSpot(spot);
2626
};
27-
let [fontsLoaded] = useFonts({
28-
UrbanistBold: require("../../assets/fonts/Urbanist-Bold.ttf"),
29-
UrbanistMedium: require("../../assets/fonts/Urbanist-Regular.ttf"),
30-
UrbanistSemiBold: require("../../assets/fonts/Urbanist-SemiBold.ttf"),
31-
UrbanistRegular: require("../../assets/fonts/Urbanist-Regular.ttf"),
32-
});
33-
if (!fontsLoaded) {
34-
return null;
35-
}
3627
const docCards = [
3728
{
3829
name: "Dr. Travis Westaby",
@@ -126,15 +117,17 @@ export default function DoctorDetails() {
126117
transparent={true}
127118
onRequestClose={toggleModal}
128119
>
129-
<View style={{ flex: 1, justifyContent: 'flex-end', alignItems: 'flex-end', backgroundColor: 'rgba(0,0,0,0.5)' }}>
120+
<TouchableWithoutFeedback onPress={() => setIsVisible(false)}>
121+
<View style={{ flex: 1, justifyContent: 'flex-end', alignItems: 'flex-end', backgroundColor: 'rgba(0,0,0,0.5)' }} >
122+
<TouchableWithoutFeedback>
130123
<View style={{ backgroundColor: 'white', borderTopRightRadius: 48, borderTopLeftRadius: 48 }}>
131124
<Text style={styles.title}>Remove from favorite?</Text>
132125
<Text style={styles.line}></Text>
133126
{selectedSpot && (
134127
<>
135128
<View className="bg-white rounded-3xl p-4 m-4" style={styles.card1}>
136129
<View className="flex-row justify-between w-full">
137-
<Image source={selectedSpot.images} />
130+
<Image source={selectedSpot.images} className="w-28 h-28"/>
138131
<View style={styles.details}>
139132
<Text style={styles.title1}>{selectedSpot.name}</Text>
140133
<Text style={styles.line}></Text>
@@ -167,8 +160,11 @@ export default function DoctorDetails() {
167160
</>
168161
)}
169162
</View>
163+
</TouchableWithoutFeedback>
170164
</View>
165+
</TouchableWithoutFeedback>
171166
</Modal>
167+
172168
</View>
173169
</ScrollView>
174170
</View>

app/Doctors/searchDoctor.tsx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { StatusBar } from "expo-status-bar";
44
import { NavigationHeader } from "@/components/NavigationHeader";
55
import DocButton from "../../components/cards/DocButtons";
66
import React, { useState, useEffect } from "react";
7-
import {
8-
StyleSheet, View, Image, TouchableOpacity, Text, Animated,
7+
import { View, Image, Animated,
98
Easing
109
} from "react-native";
1110
import { SearchInput } from "../../components/searchinput2";
@@ -42,30 +41,17 @@ export default function searchDoctor() {
4241

4342
<View className="flex-1 bg-white px-4 py-5">
4443
<View className="pt-10 ">
45-
<View className="flex-row py-2">
44+
<View className="flex-row justify-around">
4645
<NavigationHeader title="" />
4746
<SearchInput />
4847
</View>
4948
<DocButton selectedCategory={selectedCategory} onCategorySelect={setSelectedCategory} />
5049
</View>
51-
<View style={styles.loading}>
50+
<View className="flex-1 justify-center items-center">
5251
<View>
5352

5453
<Animated.View style={{ transform: [{ rotate }] }}><Image source={require("../../assets/doctors/loading.png")} /></Animated.View>
5554
</View>
5655
</View>
5756
</View>)
5857
}
59-
const styles = StyleSheet.create({
60-
images: {
61-
width: 28,
62-
height: 28,
63-
marginHorizontal: 10,
64-
marginTop: 15,
65-
},
66-
loading: {
67-
flex: 1,
68-
justifyContent: "center",
69-
alignItems: "center",
70-
}
71-
})

0 commit comments

Comments
 (0)