From 2c463df78ccd2c6df6481edb0b7edd8632172cb3 Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 03:35:33 +0900 Subject: [PATCH 01/11] =?UTF-8?q?[ADD/#15]=20TerningTopAppBar=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/topappbar/TerningTopAppBar.kt | 37 +++++++++++++++++++ .../com/terning/feature/main/MainScreen.kt | 6 +-- 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 core/src/main/java/com/terning/core/component/topappbar/TerningTopAppBar.kt diff --git a/core/src/main/java/com/terning/core/component/topappbar/TerningTopAppBar.kt b/core/src/main/java/com/terning/core/component/topappbar/TerningTopAppBar.kt new file mode 100644 index 000000000..b567c79e0 --- /dev/null +++ b/core/src/main/java/com/terning/core/component/topappbar/TerningTopAppBar.kt @@ -0,0 +1,37 @@ +package com.terning.core.component.topappbar + +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material.icons.filled.Menu +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.runtime.Composable + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun TerningTopAppBar( + title: String, +) { + TopAppBar( + title = { Text(text = title) }, + navigationIcon = { + IconButton(onClick = {}) { + Icon( + imageVector = Icons.AutoMirrored.Filled.ArrowBack, + contentDescription = "Localized description" + ) + } + }, + actions = { + IconButton(onClick = {}) { + Icon( + imageVector = Icons.Filled.Menu, + contentDescription = "Localized description" + ) + } + }, + ) +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 257bf2e23..1f212ca12 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -7,13 +7,10 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.material3.Icon -import androidx.compose.material3.LocalAbsoluteTonalElevation -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem import androidx.compose.material3.Scaffold import androidx.compose.material3.Text -import androidx.compose.material3.surfaceColorAtElevation import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource @@ -21,9 +18,11 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.navigation.compose.NavHost +import com.terning.core.component.topappbar.TerningTopAppBar 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.R import com.terning.feature.calendar.navigation.calendarNavGraph import com.terning.feature.home.navigation.homeNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph @@ -36,6 +35,7 @@ fun MainScreen( navigator: MainNavigator = rememberMainNavigator(), ) { Scaffold( + topBar = { TerningTopAppBar(title = stringResource(id = R.string.app_name)) }, bottomBar = { MainBottomBar( isVisible = navigator.showBottomBar(), From 2f584639375cca496e2bcaf4e06337bd0999bbd0 Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 03:49:16 +0900 Subject: [PATCH 02/11] =?UTF-8?q?[FEAT/#15]=20TerningTopAppBar=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/topappbar/TerningTopAppBar.kt | 37 --------------- .../component/topappbar/TerningTopAppBar.kt | 46 +++++++++++++++++++ .../com/terning/feature/main/MainScreen.kt | 2 +- feature/src/main/res/drawable/ic_btn_back.xml | 13 ++++++ feature/src/main/res/values/strings.xml | 2 + 5 files changed, 62 insertions(+), 38 deletions(-) delete mode 100644 core/src/main/java/com/terning/core/component/topappbar/TerningTopAppBar.kt create mode 100644 feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt create mode 100644 feature/src/main/res/drawable/ic_btn_back.xml diff --git a/core/src/main/java/com/terning/core/component/topappbar/TerningTopAppBar.kt b/core/src/main/java/com/terning/core/component/topappbar/TerningTopAppBar.kt deleted file mode 100644 index b567c79e0..000000000 --- a/core/src/main/java/com/terning/core/component/topappbar/TerningTopAppBar.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.terning.core.component.topappbar - -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.automirrored.filled.ArrowBack -import androidx.compose.material.icons.filled.Menu -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.Text -import androidx.compose.material3.TopAppBar -import androidx.compose.runtime.Composable - -@OptIn(ExperimentalMaterial3Api::class) -@Composable -fun TerningTopAppBar( - title: String, -) { - TopAppBar( - title = { Text(text = title) }, - navigationIcon = { - IconButton(onClick = {}) { - Icon( - imageVector = Icons.AutoMirrored.Filled.ArrowBack, - contentDescription = "Localized description" - ) - } - }, - actions = { - IconButton(onClick = {}) { - Icon( - imageVector = Icons.Filled.Menu, - contentDescription = "Localized description" - ) - } - }, - ) -} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt new file mode 100644 index 000000000..16c3269fe --- /dev/null +++ b/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt @@ -0,0 +1,46 @@ +package com.terning.feature.component.topappbar + +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import com.terning.feature.R + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun TerningTopAppBar( + title: String, + showBackButton: Boolean = false, + customActions: List<@Composable (() -> Unit)>? = null, + onBackButtonClick: (() -> Unit)? = null, +) { + TopAppBar( + title = { + Text(text = title, modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center) + }, + navigationIcon = { + if (showBackButton) { + IconButton(onClick = { + onBackButtonClick?.invoke() + }) { + Icon( + painter = painterResource(id = R.drawable.ic_btn_back), + contentDescription = stringResource(id = R.string.ic_btn_back) + ) + } + } + }, + actions = { + customActions?.forEach { customAction -> + customAction() + } + }, + ) +} diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 1f212ca12..7cbde2cbe 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -18,7 +18,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.navigation.compose.NavHost -import com.terning.core.component.topappbar.TerningTopAppBar +import com.terning.feature.component.topappbar.TerningTopAppBar import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.White diff --git a/feature/src/main/res/drawable/ic_btn_back.xml b/feature/src/main/res/drawable/ic_btn_back.xml new file mode 100644 index 000000000..fac96f803 --- /dev/null +++ b/feature/src/main/res/drawable/ic_btn_back.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 133c0442b..37c3d4a4c 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -10,4 +10,6 @@ 탐색 마이페이지 + + 뒤로가기 버튼 \ No newline at end of file From 10074f44018d9fb2048cf5a23990100000a37230 Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 04:10:28 +0900 Subject: [PATCH 03/11] =?UTF-8?q?[FEAT/#15]=20CenterAlignedTopAppBar?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=98=EC=97=AC=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../topappbar/BackWithTitleTopAppBar.kt | 11 +++++++++++ .../topappbar/BackWithoutTitleTopAppBar.kt | 10 ++++++++++ .../component/topappbar/TerningTopAppBar.kt | 17 +++++++++-------- .../com/terning/feature/main/MainNavigator.kt | 2 +- .../java/com/terning/feature/main/MainScreen.kt | 5 ++--- 5 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/component/topappbar/BackWithTitleTopAppBar.kt create mode 100644 feature/src/main/java/com/terning/feature/component/topappbar/BackWithoutTitleTopAppBar.kt diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/BackWithTitleTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/BackWithTitleTopAppBar.kt new file mode 100644 index 000000000..8ce849e94 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/component/topappbar/BackWithTitleTopAppBar.kt @@ -0,0 +1,11 @@ +package com.terning.feature.component.topappbar + +import androidx.compose.runtime.Composable + +@Composable +fun BackWithTitleTopAppBar(title: String, onBackButtonClick: () -> Unit) { + TerningTopAppBar( + title = title, + showBackButton = true, + onBackButtonClick = { onBackButtonClick.invoke() }) +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/BackWithoutTitleTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/BackWithoutTitleTopAppBar.kt new file mode 100644 index 000000000..329912568 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/component/topappbar/BackWithoutTitleTopAppBar.kt @@ -0,0 +1,10 @@ +package com.terning.feature.component.topappbar + +import androidx.compose.runtime.Composable + +@Composable +fun BackWithTitleTopAppBar(onBackButtonClick: () -> Unit) { + TerningTopAppBar( + showBackButton = true, + onBackButtonClick = { onBackButtonClick.invoke() }) +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt index 16c3269fe..efc9393d4 100644 --- a/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt +++ b/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt @@ -1,29 +1,30 @@ package com.terning.feature.component.topappbar -import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Text -import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.style.TextAlign +import com.terning.core.designsystem.theme.TerningTypography import com.terning.feature.R @OptIn(ExperimentalMaterial3Api::class) @Composable fun TerningTopAppBar( - title: String, + title: String = "", showBackButton: Boolean = false, customActions: List<@Composable (() -> Unit)>? = null, onBackButtonClick: (() -> Unit)? = null, ) { - TopAppBar( + CenterAlignedTopAppBar( title = { - Text(text = title, modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center) + Text( + text = title, + style = TerningTypography().title2, + ) }, navigationIcon = { if (showBackButton) { @@ -41,6 +42,6 @@ fun TerningTopAppBar( customActions?.forEach { customAction -> customAction() } - }, + } ) } diff --git a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt index a885ac342..90865526e 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -46,7 +46,7 @@ class MainNavigator( } } - private fun navigateUp() { + fun navigateUp() { navController.navigateUp() } diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 7cbde2cbe..6d4058143 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -18,12 +18,11 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.navigation.compose.NavHost -import com.terning.feature.component.topappbar.TerningTopAppBar 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.R import com.terning.feature.calendar.navigation.calendarNavGraph +import com.terning.feature.component.topappbar.BackWithTitleTopAppBar import com.terning.feature.home.navigation.homeNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph import com.terning.feature.search.navigation.searchNavGraph @@ -35,7 +34,7 @@ fun MainScreen( navigator: MainNavigator = rememberMainNavigator(), ) { Scaffold( - topBar = { TerningTopAppBar(title = stringResource(id = R.string.app_name)) }, + topBar = { BackWithTitleTopAppBar(title = "Terning") { navigator.navigateUp() } }, bottomBar = { MainBottomBar( isVisible = navigator.showBottomBar(), From 3cd0c3026bbfb4f8645d0e17fcea8b1f35891844 Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 04:12:16 +0900 Subject: [PATCH 04/11] =?UTF-8?q?[DELETE/#15]=20BackWithTitleTopAppBar=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/topappbar/BackWithoutTitleTopAppBar.kt | 10 ---------- .../main/java/com/terning/feature/main/MainScreen.kt | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 feature/src/main/java/com/terning/feature/component/topappbar/BackWithoutTitleTopAppBar.kt diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/BackWithoutTitleTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/BackWithoutTitleTopAppBar.kt deleted file mode 100644 index 329912568..000000000 --- a/feature/src/main/java/com/terning/feature/component/topappbar/BackWithoutTitleTopAppBar.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.terning.feature.component.topappbar - -import androidx.compose.runtime.Composable - -@Composable -fun BackWithTitleTopAppBar(onBackButtonClick: () -> Unit) { - TerningTopAppBar( - showBackButton = true, - onBackButtonClick = { onBackButtonClick.invoke() }) -} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 6d4058143..e55f6e7c4 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -34,7 +34,7 @@ fun MainScreen( navigator: MainNavigator = rememberMainNavigator(), ) { Scaffold( - topBar = { BackWithTitleTopAppBar(title = "Terning") { navigator.navigateUp() } }, + topBar = { BackWithTitleTopAppBar(title = "") { navigator.navigateUp() } }, bottomBar = { MainBottomBar( isVisible = navigator.showBottomBar(), From 0d0eb2dec4009e84a10a6db37f1d8dcf307d1821 Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 04:15:39 +0900 Subject: [PATCH 05/11] =?UTF-8?q?[FEAT/#15]=20=EB=92=A4=EB=A1=9C=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20TopAppBar=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{BackWithTitleTopAppBar.kt => BackButtonTopAppBar.kt} | 8 ++++++-- .../src/main/java/com/terning/feature/main/MainScreen.kt | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) rename feature/src/main/java/com/terning/feature/component/topappbar/{BackWithTitleTopAppBar.kt => BackButtonTopAppBar.kt} (50%) diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/BackWithTitleTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/BackButtonTopAppBar.kt similarity index 50% rename from feature/src/main/java/com/terning/feature/component/topappbar/BackWithTitleTopAppBar.kt rename to feature/src/main/java/com/terning/feature/component/topappbar/BackButtonTopAppBar.kt index 8ce849e94..8f41fe97a 100644 --- a/feature/src/main/java/com/terning/feature/component/topappbar/BackWithTitleTopAppBar.kt +++ b/feature/src/main/java/com/terning/feature/component/topappbar/BackButtonTopAppBar.kt @@ -1,11 +1,15 @@ package com.terning.feature.component.topappbar import androidx.compose.runtime.Composable +import com.terning.feature.main.MainNavigator @Composable -fun BackWithTitleTopAppBar(title: String, onBackButtonClick: () -> Unit) { +fun BackButtonTopAppBar( + title: String, navigator: MainNavigator, +) { TerningTopAppBar( title = title, showBackButton = true, - onBackButtonClick = { onBackButtonClick.invoke() }) + onBackButtonClick = { navigator.navigateUp() }, + ) } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index e55f6e7c4..fe6620ef7 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -22,7 +22,7 @@ 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.feature.component.topappbar.BackWithTitleTopAppBar +import com.terning.feature.component.topappbar.BackButtonTopAppBar import com.terning.feature.home.navigation.homeNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph import com.terning.feature.search.navigation.searchNavGraph @@ -34,7 +34,7 @@ fun MainScreen( navigator: MainNavigator = rememberMainNavigator(), ) { Scaffold( - topBar = { BackWithTitleTopAppBar(title = "") { navigator.navigateUp() } }, + topBar = { BackButtonTopAppBar(title = "", navigator = navigator) }, bottomBar = { MainBottomBar( isVisible = navigator.showBottomBar(), From 224a7f3029305a6ecff2e18891f3b8edd3e353ec Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 04:22:41 +0900 Subject: [PATCH 06/11] =?UTF-8?q?[FEAT/#15]=20=EB=A1=9C=EA=B3=A0=20TopAppB?= =?UTF-8?q?ar=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/topappbar/LogoTopAppBar.kt | 20 ++++++++++++++ .../component/topappbar/TerningTopAppBar.kt | 27 +++++++++++++------ .../com/terning/feature/main/MainScreen.kt | 3 ++- .../drawable/{ic_btn_back.xml => ic_back.xml} | 0 feature/src/main/res/drawable/ic_logo.xml | 13 +++++++++ feature/src/main/res/values/strings.xml | 3 ++- 6 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/component/topappbar/LogoTopAppBar.kt rename feature/src/main/res/drawable/{ic_btn_back.xml => ic_back.xml} (100%) create mode 100644 feature/src/main/res/drawable/ic_logo.xml diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/LogoTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/LogoTopAppBar.kt new file mode 100644 index 000000000..3eae4a974 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/component/topappbar/LogoTopAppBar.kt @@ -0,0 +1,20 @@ +package com.terning.feature.component.topappbar + +import androidx.compose.material3.Icon +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import com.terning.feature.R + +@Composable +fun LogoTopAppBar() { + TerningTopAppBar( + showBackButton = false, + customActions = listOf { + Icon( + painter = painterResource(id = R.drawable.ic_logo), + contentDescription = stringResource(id = R.string.ic_logo), + ) + } + ) +} diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt index efc9393d4..a64eb555e 100644 --- a/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt +++ b/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt @@ -1,13 +1,18 @@ package com.terning.feature.component.topappbar +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign import com.terning.core.designsystem.theme.TerningTypography import com.terning.feature.R @@ -21,10 +26,14 @@ fun TerningTopAppBar( ) { CenterAlignedTopAppBar( title = { - Text( - text = title, - style = TerningTypography().title2, - ) + Box(Modifier.fillMaxWidth()) { + Text( + text = title, + modifier = Modifier.align(Alignment.Center), + textAlign = TextAlign.Center, + style = TerningTypography().title2 + ) + } }, navigationIcon = { if (showBackButton) { @@ -32,16 +41,18 @@ fun TerningTopAppBar( onBackButtonClick?.invoke() }) { Icon( - painter = painterResource(id = R.drawable.ic_btn_back), - contentDescription = stringResource(id = R.string.ic_btn_back) + painter = painterResource(id = R.drawable.ic_back), + contentDescription = stringResource(id = R.string.ic_back) ) } + } else { + customActions?.getOrNull(0)?.invoke() } }, actions = { - customActions?.forEach { customAction -> + customActions?.drop(1)?.forEach { customAction -> customAction() } - } + }, ) } diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index fe6620ef7..be5104b22 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -23,6 +23,7 @@ import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.White import com.terning.feature.calendar.navigation.calendarNavGraph import com.terning.feature.component.topappbar.BackButtonTopAppBar +import com.terning.feature.component.topappbar.LogoTopAppBar import com.terning.feature.home.navigation.homeNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph import com.terning.feature.search.navigation.searchNavGraph @@ -34,7 +35,7 @@ fun MainScreen( navigator: MainNavigator = rememberMainNavigator(), ) { Scaffold( - topBar = { BackButtonTopAppBar(title = "", navigator = navigator) }, + topBar = { LogoTopAppBar() }, bottomBar = { MainBottomBar( isVisible = navigator.showBottomBar(), diff --git a/feature/src/main/res/drawable/ic_btn_back.xml b/feature/src/main/res/drawable/ic_back.xml similarity index 100% rename from feature/src/main/res/drawable/ic_btn_back.xml rename to feature/src/main/res/drawable/ic_back.xml diff --git a/feature/src/main/res/drawable/ic_logo.xml b/feature/src/main/res/drawable/ic_logo.xml new file mode 100644 index 000000000..7931bbb86 --- /dev/null +++ b/feature/src/main/res/drawable/ic_logo.xml @@ -0,0 +1,13 @@ + + + + diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 37c3d4a4c..91869b2a9 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -11,5 +11,6 @@ 마이페이지 - 뒤로가기 버튼 + 뒤로가기 버튼 + 탑 바 로고 \ No newline at end of file From 3b15164289ef9cacbd34aac9ccb0230d5f1f6e5c Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 04:30:46 +0900 Subject: [PATCH 07/11] =?UTF-8?q?[FEAT/#15]=20MyPageTopAppBar=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/topappbar/MyPageTopAppBar.kt | 42 +++++++++++++++++++ .../com/terning/feature/main/MainScreen.kt | 3 +- feature/src/main/res/drawable/ic_20_right.xml | 13 ++++++ feature/src/main/res/values/strings.xml | 1 + 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt create mode 100644 feature/src/main/res/drawable/ic_20_right.xml diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt new file mode 100644 index 000000000..8b1f3d985 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt @@ -0,0 +1,42 @@ +package com.terning.feature.component.topappbar + +import androidx.compose.foundation.layout.Row +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import com.terning.core.designsystem.theme.TerningTypography +import com.terning.feature.R + +@Composable +fun MyPageTopAppBar() { + TerningTopAppBar( + showBackButton = false, + customActions = listOf( + {}, + { + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = "프로필 수정", + style = TerningTypography().button3, + textAlign = TextAlign.Center + ) + IconButton(onClick = { + }) { + Icon( + painter = painterResource(id = R.drawable.ic_20_right), + contentDescription = stringResource(id = R.string.ic_20_right) + ) + } + } + } + ) + ) +} diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index be5104b22..9e9349644 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -24,6 +24,7 @@ import com.terning.core.designsystem.theme.White import com.terning.feature.calendar.navigation.calendarNavGraph import com.terning.feature.component.topappbar.BackButtonTopAppBar import com.terning.feature.component.topappbar.LogoTopAppBar +import com.terning.feature.component.topappbar.MyPageTopAppBar import com.terning.feature.home.navigation.homeNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph import com.terning.feature.search.navigation.searchNavGraph @@ -35,7 +36,7 @@ fun MainScreen( navigator: MainNavigator = rememberMainNavigator(), ) { Scaffold( - topBar = { LogoTopAppBar() }, + topBar = { MyPageTopAppBar() }, bottomBar = { MainBottomBar( isVisible = navigator.showBottomBar(), diff --git a/feature/src/main/res/drawable/ic_20_right.xml b/feature/src/main/res/drawable/ic_20_right.xml new file mode 100644 index 000000000..e022a144b --- /dev/null +++ b/feature/src/main/res/drawable/ic_20_right.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 91869b2a9..dac394093 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -13,4 +13,5 @@ 뒤로가기 버튼 탑 바 로고 + 오른쪽 버튼 \ No newline at end of file From 2b4279480a7bd9d4d04a05b86f704acb1a33b77d Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 04:37:06 +0900 Subject: [PATCH 08/11] =?UTF-8?q?[FEAT/#15]=20=EB=A3=A8=ED=8A=B8=EC=97=90?= =?UTF-8?q?=20=EB=94=B0=EB=9D=BC=20TopAppBar=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/component/topappbar/MyPageTopAppBar.kt | 3 +-- .../main/java/com/terning/feature/main/MainScreen.kt | 12 ++++++++++-- feature/src/main/res/values/strings.xml | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt index 8b1f3d985..8a1ecc29b 100644 --- a/feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt +++ b/feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt @@ -1,7 +1,6 @@ package com.terning.feature.component.topappbar import androidx.compose.foundation.layout.Row -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Text @@ -24,7 +23,7 @@ fun MyPageTopAppBar() { verticalAlignment = Alignment.CenterVertically ) { Text( - text = "프로필 수정", + text = stringResource(id = R.string.my_page_top_app_bar), style = TerningTypography().button3, textAlign = TextAlign.Center ) diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 9e9349644..216aad734 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -22,9 +22,9 @@ 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.feature.component.topappbar.BackButtonTopAppBar import com.terning.feature.component.topappbar.LogoTopAppBar import com.terning.feature.component.topappbar.MyPageTopAppBar +import com.terning.feature.component.topappbar.TerningTopAppBar import com.terning.feature.home.navigation.homeNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph import com.terning.feature.search.navigation.searchNavGraph @@ -36,7 +36,15 @@ fun MainScreen( navigator: MainNavigator = rememberMainNavigator(), ) { Scaffold( - topBar = { MyPageTopAppBar() }, + topBar = { + when (navigator.currentTab) { + MainTab.HOME -> LogoTopAppBar() + MainTab.CALENDAR -> TerningTopAppBar() + MainTab.SEARCH -> LogoTopAppBar() + MainTab.MY_PAGE -> MyPageTopAppBar() + null -> LogoTopAppBar() + } + }, bottomBar = { MainBottomBar( isVisible = navigator.showBottomBar(), diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index dac394093..0b28a3d7e 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -14,4 +14,7 @@ 뒤로가기 버튼 탑 바 로고 오른쪽 버튼 + + + 프로필 수정 \ No newline at end of file From 4362d0f365974fded65ca076bd726607d2546c39 Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 17:07:31 +0900 Subject: [PATCH 09/11] =?UTF-8?q?[MOVE/#15]=20core=20designsystem=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/topappbar/BackButtonTopAppBar.kt | 14 ++++++++++++++ .../core/designsystem}/topappbar/LogoTopAppBar.kt | 4 ++-- .../designsystem}/topappbar/MyPageTopAppBar.kt | 6 +++--- .../designsystem}/topappbar/TerningTopAppBar.kt | 14 +++++++------- .../src/main/res/drawable/ic_back.xml | 0 .../src/main/res/drawable/ic_logo.xml | 0 .../src/main/res/drawable/ic_right.xml | 0 core/src/main/res/values/strings.xml | 10 ++++++++++ .../component/topappbar/BackButtonTopAppBar.kt | 15 --------------- .../java/com/terning/feature/main/MainScreen.kt | 6 +++--- feature/src/main/res/values/strings.xml | 8 -------- 11 files changed, 39 insertions(+), 38 deletions(-) create mode 100644 core/src/main/java/com/terning/core/designsystem/topappbar/BackButtonTopAppBar.kt rename {feature/src/main/java/com/terning/feature/component => core/src/main/java/com/terning/core/designsystem}/topappbar/LogoTopAppBar.kt (86%) rename {feature/src/main/java/com/terning/feature/component => core/src/main/java/com/terning/core/designsystem}/topappbar/MyPageTopAppBar.kt (93%) rename {feature/src/main/java/com/terning/feature/component => core/src/main/java/com/terning/core/designsystem}/topappbar/TerningTopAppBar.kt (82%) rename {feature => core}/src/main/res/drawable/ic_back.xml (100%) rename {feature => core}/src/main/res/drawable/ic_logo.xml (100%) rename feature/src/main/res/drawable/ic_20_right.xml => core/src/main/res/drawable/ic_right.xml (100%) create mode 100644 core/src/main/res/values/strings.xml delete mode 100644 feature/src/main/java/com/terning/feature/component/topappbar/BackButtonTopAppBar.kt diff --git a/core/src/main/java/com/terning/core/designsystem/topappbar/BackButtonTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/BackButtonTopAppBar.kt new file mode 100644 index 000000000..aeb7f1b00 --- /dev/null +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/BackButtonTopAppBar.kt @@ -0,0 +1,14 @@ +package com.terning.core.designsystem.topappbar + +import androidx.compose.runtime.Composable + +@Composable +fun BackButtonTopAppBar( + title: String, onBackButtonClick: (() -> Unit), +) { + TerningTopAppBar( + title = title, + showBackButton = true, + onBackButtonClick = { onBackButtonClick.invoke() }, + ) +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/LogoTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt similarity index 86% rename from feature/src/main/java/com/terning/feature/component/topappbar/LogoTopAppBar.kt rename to core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt index 3eae4a974..8626a35d6 100644 --- a/feature/src/main/java/com/terning/feature/component/topappbar/LogoTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt @@ -1,10 +1,10 @@ -package com.terning.feature.component.topappbar +package com.terning.core.designsystem.topappbar import androidx.compose.material3.Icon import androidx.compose.runtime.Composable import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import com.terning.feature.R +import com.terning.core.R @Composable fun LogoTopAppBar() { diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt similarity index 93% rename from feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt rename to core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt index 8a1ecc29b..0f3d31ec0 100644 --- a/feature/src/main/java/com/terning/feature/component/topappbar/MyPageTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt @@ -1,4 +1,4 @@ -package com.terning.feature.component.topappbar +package com.terning.core.designsystem.topappbar import androidx.compose.foundation.layout.Row import androidx.compose.material3.Icon @@ -9,8 +9,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign +import com.terning.core.R import com.terning.core.designsystem.theme.TerningTypography -import com.terning.feature.R @Composable fun MyPageTopAppBar() { @@ -30,7 +30,7 @@ fun MyPageTopAppBar() { IconButton(onClick = { }) { Icon( - painter = painterResource(id = R.drawable.ic_20_right), + painter = painterResource(id = R.drawable.ic_right), contentDescription = stringResource(id = R.string.ic_20_right) ) } diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt similarity index 82% rename from feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt rename to core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt index a64eb555e..adbbae65b 100644 --- a/feature/src/main/java/com/terning/feature/component/topappbar/TerningTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt @@ -1,4 +1,4 @@ -package com.terning.feature.component.topappbar +package com.terning.core.designsystem.topappbar import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth @@ -13,16 +13,16 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign +import com.terning.core.R import com.terning.core.designsystem.theme.TerningTypography -import com.terning.feature.R @OptIn(ExperimentalMaterial3Api::class) @Composable fun TerningTopAppBar( title: String = "", showBackButton: Boolean = false, - customActions: List<@Composable (() -> Unit)>? = null, - onBackButtonClick: (() -> Unit)? = null, + customActions: List<@Composable () -> Unit> = emptyList(), + onBackButtonClick: () -> Unit = {}, ) { CenterAlignedTopAppBar( title = { @@ -38,7 +38,7 @@ fun TerningTopAppBar( navigationIcon = { if (showBackButton) { IconButton(onClick = { - onBackButtonClick?.invoke() + onBackButtonClick.invoke() }) { Icon( painter = painterResource(id = R.drawable.ic_back), @@ -46,11 +46,11 @@ fun TerningTopAppBar( ) } } else { - customActions?.getOrNull(0)?.invoke() + customActions.getOrNull(0)?.invoke() } }, actions = { - customActions?.drop(1)?.forEach { customAction -> + customActions.drop(1).forEach { customAction -> customAction() } }, diff --git a/feature/src/main/res/drawable/ic_back.xml b/core/src/main/res/drawable/ic_back.xml similarity index 100% rename from feature/src/main/res/drawable/ic_back.xml rename to core/src/main/res/drawable/ic_back.xml diff --git a/feature/src/main/res/drawable/ic_logo.xml b/core/src/main/res/drawable/ic_logo.xml similarity index 100% rename from feature/src/main/res/drawable/ic_logo.xml rename to core/src/main/res/drawable/ic_logo.xml diff --git a/feature/src/main/res/drawable/ic_20_right.xml b/core/src/main/res/drawable/ic_right.xml similarity index 100% rename from feature/src/main/res/drawable/ic_20_right.xml rename to core/src/main/res/drawable/ic_right.xml diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml new file mode 100644 index 000000000..78c239c7f --- /dev/null +++ b/core/src/main/res/values/strings.xml @@ -0,0 +1,10 @@ + + + + 뒤로가기 버튼 + 탑 바 로고 + 오른쪽 버튼 + + + 프로필 수정 + \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/component/topappbar/BackButtonTopAppBar.kt b/feature/src/main/java/com/terning/feature/component/topappbar/BackButtonTopAppBar.kt deleted file mode 100644 index 8f41fe97a..000000000 --- a/feature/src/main/java/com/terning/feature/component/topappbar/BackButtonTopAppBar.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.terning.feature.component.topappbar - -import androidx.compose.runtime.Composable -import com.terning.feature.main.MainNavigator - -@Composable -fun BackButtonTopAppBar( - title: String, navigator: MainNavigator, -) { - TerningTopAppBar( - title = title, - showBackButton = true, - onBackButtonClick = { navigator.navigateUp() }, - ) -} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 216aad734..a516ec199 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -22,9 +22,9 @@ 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.feature.component.topappbar.LogoTopAppBar -import com.terning.feature.component.topappbar.MyPageTopAppBar -import com.terning.feature.component.topappbar.TerningTopAppBar +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.home.navigation.homeNavGraph import com.terning.feature.mypage.navigation.myPageNavGraph import com.terning.feature.search.navigation.searchNavGraph diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 0b28a3d7e..4da5427d4 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -9,12 +9,4 @@ 캘린더 탐색 마이페이지 - - - 뒤로가기 버튼 - 탑 바 로고 - 오른쪽 버튼 - - - 프로필 수정 \ No newline at end of file From 95051f84393d453b058516a9132a75c1fd830e3b Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 18:42:41 +0900 Subject: [PATCH 10/11] =?UTF-8?q?[FEAT/#15]=20=EA=B0=80=EC=9A=B4=EB=8D=B0?= =?UTF-8?q?=20=EC=A0=95=EB=A0=AC=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20null?= =?UTF-8?q?=20=EC=B2=B4=ED=81=AC=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/topappbar/LogoTopAppBar.kt | 2 +- .../designsystem/topappbar/MyPageTopAppBar.kt | 2 +- .../topappbar/TerningTopAppBar.kt | 23 ++++++++--------- .../com/terning/feature/main/MainNavigator.kt | 3 ++- .../com/terning/feature/main/MainScreen.kt | 10 +++++--- .../com/terning/feature/mypage/MyPageRoute.kt | 5 ++-- .../com/terning/feature/search/SearchRoute.kt | 25 +++++++++++++++++++ .../com/terning/feature/search/SearchRouth.kt | 19 -------------- 8 files changed, 50 insertions(+), 39 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/search/SearchRoute.kt delete mode 100644 feature/src/main/java/com/terning/feature/search/SearchRouth.kt diff --git a/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt index 8626a35d6..a5b6e68e5 100644 --- a/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/LogoTopAppBar.kt @@ -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), diff --git a/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt index 0f3d31ec0..295c5aabd 100644 --- a/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/MyPageTopAppBar.kt @@ -16,7 +16,7 @@ import com.terning.core.designsystem.theme.TerningTypography fun MyPageTopAppBar() { TerningTopAppBar( showBackButton = false, - customActions = listOf( + actions = listOf( {}, { Row( diff --git a/core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt b/core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt index adbbae65b..0e164edc5 100644 --- a/core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/topappbar/TerningTopAppBar.kt @@ -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) { @@ -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() } }, ) diff --git a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt index beb7b7920..9ab06b962 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -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 @@ -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 -> diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 359db3d10..9d51ef625 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -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 @@ -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 = { diff --git a/feature/src/main/java/com/terning/feature/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/MyPageRoute.kt index 2302237e4..f22dd2d0e 100644 --- a/feature/src/main/java/com/terning/feature/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/MyPageRoute.kt @@ -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 @@ -46,13 +47,13 @@ fun MyPageRoute( is UiState.Loading -> {} is UiState.Failure -> {} is UiState.Success -> { - MockScreen(mockList = (state.followers as UiState.Success>).data) + MyPageScreen(mockList = (state.followers as UiState.Success>).data) } } } @Composable -fun MockScreen( +fun MyPageScreen( mockList: List, ) { LazyColumn( diff --git a/feature/src/main/java/com/terning/feature/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt new file mode 100644 index 000000000..3ba7af3d4 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/search/SearchRoute.kt @@ -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 = "탐색 스크린") + } +} diff --git a/feature/src/main/java/com/terning/feature/search/SearchRouth.kt b/feature/src/main/java/com/terning/feature/search/SearchRouth.kt deleted file mode 100644 index 18c655555..000000000 --- a/feature/src/main/java/com/terning/feature/search/SearchRouth.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.terning.feature.search - -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier - -@Composable -fun SearchRoute() { - SearchScreen() -} - -@Composable -fun SearchScreen() { - Column(modifier = Modifier.fillMaxSize()) { - Text(text = "탐색 스크린") - } -} \ No newline at end of file From dc5d08171412c54cdffa9be0e8c2def09e24717b Mon Sep 17 00:00:00 2001 From: arinming Date: Sun, 7 Jul 2024 18:46:44 +0900 Subject: [PATCH 11/11] =?UTF-8?q?[FEAT/#15]=20=EC=B4=88=EA=B8=B0=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/main/MainNavigator.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt index 9ab06b962..beb7b7920 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -10,7 +10,6 @@ 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 @@ -23,7 +22,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = Home + val startDestination = SignIn val currentTab: MainTab? @Composable get() = MainTab.find { tab ->