Skip to content

Commit

Permalink
📝 add navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdcksdn committed Apr 22, 2024
1 parent 2b9fdb9 commit 7ea477c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies {
implementation(project(":feature:student-activity"))
implementation(project(":feature:my-page"))
implementation(project(":feature:post"))
implementation(project(":feature:club"))
implementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import com.example.my_page.navigation.navigateToMyPage
import com.example.my_page.navigation.navigateToPasswordChange
import com.msg.sign_up.navigation.navigateToSignUp
import com.msg.bitgoeul_android.ui.BitgoeulAppState
import com.msg.club.navigation.clubDetailScreen
import com.msg.club.navigation.clubScreen
import com.msg.club.navigation.navigateToClubDetailPage
import com.msg.post.navigation.navigateToPostAddPage
import com.msg.post.navigation.navigateToPostDetailPage
import com.msg.post.navigation.navigateToPostDetailSettingPage
Expand Down Expand Up @@ -91,5 +94,13 @@ fun BitgoeulNavHost(
postDetailSettingScreen(
onCloseClicked = navController::popBackStack
)
clubScreen(
onItemClicked = navController::navigateToClubDetailPage
)
clubDetailScreen(
onBackClickedByAdmin = navController::popBackStack,
//onBackClicked = navController::navigateToMainPage
onBackClicked = navController::popBackStack
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ enum class TopLevelDestination {
SIGN_UP,
STUDENT_ACTIVITY,
MY_PAGE,
POST
POST,
CLUB
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.msg.club.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.msg.club.ClubDetailScreenRoute
import com.msg.club.ClubScreenRoute

const val clubRoute = "club_route"
const val clubDetailRoute = "club_detail_route"

fun NavController.navigateToClubPage(navOptions: NavOptions? = null) {
this.navigate(clubRoute, navOptions)
}

fun NavGraphBuilder.clubScreen(onItemClicked: () -> Unit) {
composable(route = clubRoute) {
ClubScreenRoute(
onItemClicked = onItemClicked
)
}
}

fun NavController.navigateToClubDetailPage(navOptions: NavOptions? = null) {
this.navigate(clubDetailRoute, navOptions)
}

fun NavGraphBuilder.clubDetailScreen(onBackClicked: () -> Unit, onBackClickedByAdmin: () -> Unit) {
composable(route = clubDetailRoute) {
ClubDetailScreenRoute(
onBackClicked = onBackClicked,
onBackClickedByAdmin = onBackClickedByAdmin
)
}
}

0 comments on commit 7ea477c

Please sign in to comment.