Skip to content

Commit

Permalink
[FEAT/#15] 가운데 정렬 수정 및 null 체크 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
arinming committed Jul 7, 2024
1 parent 31bf20d commit 95051f8
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.terning.core.R
fun LogoTopAppBar() {
TerningTopAppBar(
showBackButton = false,
customActions = listOf {
actions = listOf {
Icon(
painter = painterResource(id = R.drawable.ic_logo),
contentDescription = stringResource(id = R.string.ic_logo),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import com.terning.core.designsystem.theme.TerningTypography
fun MyPageTopAppBar() {
TerningTopAppBar(
showBackButton = false,
customActions = listOf(
actions = listOf(
{},
{
Row(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@ import com.terning.core.designsystem.theme.TerningTypography
fun TerningTopAppBar(
title: String = "",
showBackButton: Boolean = false,
customActions: List<@Composable () -> Unit> = emptyList(),
actions: List<@Composable () -> Unit> = emptyList(),
onBackButtonClick: () -> Unit = {},
) {
CenterAlignedTopAppBar(
title = {
Box(Modifier.fillMaxWidth()) {
Text(
text = title,
modifier = Modifier.align(Alignment.Center),
textAlign = TextAlign.Center,
style = TerningTypography().title2
)
}

Text(
text = title,
textAlign = TextAlign.Center,
style = TerningTypography().title2
)

},
navigationIcon = {
if (showBackButton) {
Expand All @@ -46,12 +45,12 @@ fun TerningTopAppBar(
)
}
} else {
customActions.getOrNull(0)?.invoke()
actions.getOrNull(0)?.invoke()
}
},
actions = {
customActions.drop(1).forEach { customAction ->
customAction()
actions.drop(1).forEach { action ->
action()
}
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navOptions
import com.terning.feature.calendar.navigation.navigateCalendar
import com.terning.feature.home.navigation.Home
import com.terning.feature.home.navigation.navigateHome
import com.terning.feature.mypage.navigation.navigateMyPage
import com.terning.feature.onboarding.signin.navigation.SignIn
Expand All @@ -22,7 +23,7 @@ class MainNavigator(
@Composable get() = navController
.currentBackStackEntryAsState().value?.destination

val startDestination = SignIn
val startDestination = Home

val currentTab: MainTab?
@Composable get() = MainTab.find { tab ->
Expand Down
10 changes: 7 additions & 3 deletions feature/src/main/java/com/terning/feature/main/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import androidx.navigation.compose.NavHost
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.White
import com.terning.feature.calendar.navigation.calendarNavGraph
import com.terning.core.designsystem.topappbar.BackButtonTopAppBar
import com.terning.core.designsystem.topappbar.LogoTopAppBar
import com.terning.core.designsystem.topappbar.MyPageTopAppBar
import com.terning.core.designsystem.topappbar.TerningTopAppBar
import com.terning.feature.calendar.navigation.calendarNavGraph
import com.terning.feature.home.navigation.homeNavGraph
import com.terning.feature.mypage.navigation.myPageNavGraph
import com.terning.feature.onboarding.signin.navigation.signInNavGraph
Expand All @@ -41,10 +42,13 @@ fun MainScreen(
topBar = {
when (navigator.currentTab) {
MainTab.HOME -> LogoTopAppBar()
MainTab.CALENDAR -> TerningTopAppBar()
MainTab.CALENDAR -> BackButtonTopAppBar(
title = "dkssud",
onBackButtonClick = { navigator.navigateUp() })

MainTab.SEARCH -> LogoTopAppBar()
MainTab.MY_PAGE -> MyPageTopAppBar()
null -> LogoTopAppBar()
null -> TerningTopAppBar()
}
},
bottomBar = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.flowWithLifecycle
import com.terning.core.designsystem.topappbar.MyPageTopAppBar
import com.terning.core.extension.toast
import com.terning.core.state.UiState
import com.terning.domain.entity.response.MockResponseModel
Expand Down Expand Up @@ -46,13 +47,13 @@ fun MyPageRoute(
is UiState.Loading -> {}
is UiState.Failure -> {}
is UiState.Success -> {
MockScreen(mockList = (state.followers as UiState.Success<List<MockResponseModel>>).data)
MyPageScreen(mockList = (state.followers as UiState.Success<List<MockResponseModel>>).data)
}
}
}

@Composable
fun MockScreen(
fun MyPageScreen(
mockList: List<MockResponseModel>,
) {
LazyColumn(
Expand Down
25 changes: 25 additions & 0 deletions feature/src/main/java/com/terning/feature/search/SearchRoute.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.terning.feature.search

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.terning.core.designsystem.topappbar.LogoTopAppBar

@Composable
fun SearchRoute() {
SearchScreen()
}

@Composable
fun SearchScreen(modifier: Modifier = Modifier) {
Column(
modifier = Modifier
.fillMaxWidth()
) {
Text(text = "탐색 스크린")
}
}
19 changes: 0 additions & 19 deletions feature/src/main/java/com/terning/feature/search/SearchRouth.kt

This file was deleted.

0 comments on commit 95051f8

Please sign in to comment.