Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#28 feature] 네비게이션 추가 #43

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ dependencies {
implementation(project(":core:navigation"))
implementation(project(":feature:home"))
implementation(project(":feature:storage"))
implementation(project(":feature:save"))

implementation(libs.core.ktx)
implementation(libs.kotlin.android)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.mashup.dorabangs.navigation
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import com.dorabangs.feature.navigation.navigateToSaveLink
import com.dorabangs.feature.navigation.saveLinkNavigation
import com.mashup.core.navigation.NavigationRoute
import com.mashup.dorabangs.feature.navigation.homeNavigation
import com.mashup.dorabangs.feature.storage.navigation.storageDetailNavigation
Expand All @@ -19,8 +21,11 @@ fun MainNavHost(
navController = appState.navController,
startDestination = startDestination,
) {
homeNavigation()
homeNavigation {
appState.navController.navigateToSaveLink()
}
storageNavigation(appState.navController)
storageDetailNavigation(appState.navController)
saveLinkNavigation(appState.navController)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mashup.dorabangs.core.designsystem.component.snackbar

import android.annotation.SuppressLint
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -105,10 +106,9 @@ fun SnackBarContent(
modifier = Modifier.size(24.dp),
onClick = dismissAction,
) {
Icon(
Image(
imageVector = DoraIconClose.CloseCircle,
contentDescription = stringResource(id = R.string.snack_bar_cancel_description),
tint = ClipBoardColorTokens.UrlLinkSubColor1,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ sealed class NavigationRoute(val route: String) {
object StorageScreen : NavigationRoute("storage") {
object StorageDetailScreen : NavigationRoute("storage/detail")
}
object SaveLink : NavigationRoute("save")
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import androidx.navigation.compose.composable
import com.mashup.core.navigation.NavigationRoute
import com.mashup.dorabangs.feature.home.HomeRoute

fun NavController.navigateToHome(navOptions: NavOptions) = navigate(NavigationRoute.HomeScreen.route, navOptions)
fun NavController.navigateToHome(navOptions: NavOptions) =
navigate(NavigationRoute.HomeScreen.route, navOptions)

fun NavGraphBuilder.homeNavigation() {
fun NavGraphBuilder.homeNavigation(action: () -> Unit) {
composable(
route = NavigationRoute.HomeScreen.route,
) {
HomeRoute()
HomeRoute(
actionSnackBar = action,
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.dorabangs.feature.navigation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ahn-seokjoo @ddyeon
진짜 패키지 이름 거시기 하긴 하다 ~~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ


import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.dorabangs.feature.save.DoraLinkSaveRoute
import com.mashup.core.navigation.NavigationRoute

fun NavController.navigateToSaveLink(navOptions: NavOptions? = null) =
navigate(NavigationRoute.SaveLink.route, navOptions)

fun NavGraphBuilder.saveLinkNavigation(navController: NavHostController) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ahn-seokjoo
navController를 받는 게 아니라, 람다를 받아야 할 듯 ??

composable(
route = NavigationRoute.SaveLink.route,
) {
DoraLinkSaveRoute(onClickBackIcon = {
navController.navigate(NavigationRoute.SaveLink.route)
})
}
}
Loading