Skip to content

Commit

Permalink
Feat(Favorite Doctor) add state management to change button backgroun…
Browse files Browse the repository at this point in the history
…d if it is selected
  • Loading branch information
23nosurrend committed May 16, 2024
1 parent db9e700 commit 08da579
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
9 changes: 7 additions & 2 deletions app/(app)/ActionMenu/FavoriteDoctorScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,14 @@ function DoctorScreen() {
}}>

{data.categories.map((category, index) =>
<Pressable key={index} onPress={()=>handleCategoryChange(category)} style={[styles.categoryBtn,index==0?styles.firstCategoryBtn:{}]}>
<Pressable key={index} onPress={() => handleCategoryChange(category)} style={[styles.categoryBtn,
selectedCategory === category ? styles.firstCategoryBtn : {},
]}>

<Text style={[styles.categoryBtnText,index===0?styles.firstCategoryBtnText:{}]}>{category.name}</Text>
<Text style={[
styles.categoryBtnText,
selectedCategory === category ? styles.firstCategoryBtnText : {},
]}>{category.name}</Text>

</Pressable>
)}
Expand Down
14 changes: 7 additions & 7 deletions app/doctors.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@
"Doctors":[
{
"imageSource":"doctor1.png",
"name":"dentist Dr. Travis Westaby",
"name":"Dr. Travis Westaby",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"Alka Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -147,7 +147,7 @@
"imageSource":"doctor2.png",
"name":"Dr. Nathaniel Valle",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"B&B Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -157,7 +157,7 @@
"imageSource":"doctor3.png",
"name":"Dr. Beckett Calger",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"Venus Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -167,7 +167,7 @@
"imageSource":"doctor4.png",
"name":"Dr. Jada Srnsky",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"Alka Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -177,7 +177,7 @@
"imageSource":"doctor5.png",
"name":"Dr. Bernard Bliss",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"The Valley Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -187,7 +187,7 @@
"imageSource":"doctor1.png",
"name":"Dr. Travis Westaby",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"Alka Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand Down

0 comments on commit 08da579

Please sign in to comment.