-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(recipeDetail): 레시피 상세 조회 네비게이팅 구현
- Loading branch information
1 parent
d3a02cc
commit 40c0f76
Showing
29 changed files
with
481 additions
and
366 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...ata/src/main/java/com/sundaegukbap/banchango/core/data/repository/FakeRecipeRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.sundaegukbap.banchango.core.data.repository | ||
|
||
import com.sundaegukbap.banchango.Recipe | ||
import com.sundaegukbap.banchango.core.data.repository.api.RecipeRepository | ||
import javax.inject.Inject | ||
|
||
class FakeRecipeRepository @Inject constructor() : RecipeRepository { | ||
override suspend fun getRecipeRecommendation(): Result<List<Recipe>> { | ||
return Result.success( | ||
listOf( | ||
Recipe( | ||
id = 1, | ||
name = "간장계란볶음밥", | ||
introduction = "아주 간단하면서 맛있는 계란간장볶음밥으로 한끼식사 만들어보세요. 아이들이 더 좋아할거예요.", | ||
image = "https://recipe1.ezmember.co.kr/cache/recipe/2018/05/26/d0c6701bc673ac5c18183b47212a58571.jpg", | ||
link = "https://www.10000recipe.com/recipe/6889616", | ||
cookingTime = 10, | ||
servings = 2, | ||
difficulty = "Easy", | ||
have = listOf(""), | ||
need = listOf(""), | ||
isBookmarked = false, | ||
), | ||
Recipe( | ||
id = 2, | ||
name = "간장계란볶음밥", | ||
introduction = "아주 간단하면서 맛있는 계란간장볶음밥으로 한끼식사 만들어보세요. 아이들이 더 좋아할거예요.", | ||
image = "https://recipe1.ezmember.co.kr/cache/recipe/2018/05/26/d0c6701bc673ac5c18183b47212a58571.jpg", | ||
link = "https://www.10000recipe.com/recipe/6889616", | ||
cookingTime = 10, | ||
servings = 2, | ||
difficulty = "Easy", | ||
have = listOf(""), | ||
need = listOf(""), | ||
isBookmarked = false, | ||
), | ||
|
||
Recipe( | ||
id = 3, | ||
name = "간장계란볶음밥", | ||
introduction = "아주 간단하면서 맛있는 계란간장볶음밥으로 한끼식사 만들어보세요. 아이들이 더 좋아할거예요.", | ||
image = "https://recipe1.ezmember.co.kr/cache/recipe/2018/05/26/d0c6701bc673ac5c18183b47212a58571.jpg", | ||
link = "https://www.10000recipe.com/recipe/6889616", | ||
cookingTime = 10, | ||
servings = 2, | ||
difficulty = "Easy", | ||
have = listOf(""), | ||
need = listOf(""), | ||
isBookmarked = false, | ||
), | ||
) | ||
) | ||
} | ||
|
||
override suspend fun getRecipeDetail(id: Long): Result<Recipe> { | ||
return Result.success( | ||
Recipe( | ||
id = id, | ||
name = "간장계란볶음밥", | ||
introduction = "아주 간단하면서 맛있는 계란간장볶음밥으로 한끼식사 만들어보세요. 아이들이 더 좋아할거예요.", | ||
image = "https://recipe1.ezmember.co.kr/cache/recipe/2018/05/26/d0c6701bc673ac5c18183b47212a58571.jpg", | ||
link = "https://www.10000recipe.com/recipe/6889616", | ||
cookingTime = 10, | ||
servings = 2, | ||
difficulty = "Easy", | ||
have = listOf(""), | ||
need = listOf(""), | ||
isBookmarked = false, | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions
44
...pe/src/main/java/com/sundaegukbap/banchango/feature/recipe/navigation/RecipeNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.sundaegukbap.banchango.feature.recipe.navigation | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material3.Text | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavOptions | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.toRoute | ||
import com.sundaegukbap.banchango.Recipe | ||
import com.sundaegukbap.banchango.feature.recipe.recommend.RecipeRecommendRoute | ||
import com.sundaegukbap.banchango.navigation.MainTabRoute | ||
import com.sundaegukbap.banchango.navigation.Route | ||
|
||
fun NavController.navigateRecipeRecommend(navOptions: NavOptions) { | ||
navigate(MainTabRoute.RecipeRecommend, navOptions) | ||
} | ||
|
||
fun NavController.navigateRecipeDetail(recipeId: Long) { | ||
navigate(Route.RecipeDetail(recipeId)) | ||
|
||
} | ||
|
||
fun NavGraphBuilder.recipeNavGraph( | ||
padding: PaddingValues, | ||
onRecipeClick: (Recipe) -> Unit | ||
) { | ||
composable<MainTabRoute.RecipeRecommend> { | ||
RecipeRecommendRoute( | ||
padding = padding, | ||
onRecipeClick = onRecipeClick | ||
) | ||
} | ||
|
||
composable<Route.RecipeDetail> { navBackStackEntry -> | ||
val recipeId = navBackStackEntry.toRoute<Route.RecipeDetail>().recipeId | ||
Box(modifier = Modifier.fillMaxSize()) { | ||
Text(text = "하이 $recipeId") | ||
} | ||
} | ||
} |
Oops, something went wrong.