From c676bcb6c08d8a8dd46ab6c69ec14efd4371219e Mon Sep 17 00:00:00 2001 From: Gael-Android <84790707+Gael-Android@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:13:10 +0900 Subject: [PATCH] =?UTF-8?q?[Improve]=20TopAppBar=20=EC=A0=9C=EC=9E=91=20(#?= =?UTF-8?q?242)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * TopBar, SingleTitleTopBar, SearchTitleTopBar, DoubleTitleTopBar의 머티리얼 의존성 제거 - AppBar 파일 생성 -> TopAppBar, BottomAppBar 구현 - BottomBar 구현 중 * 리뷰 반영: BottomAppBar 삭제, BottomNavigation -> BottomBar * AppBar.kt -> TopAppBar.kt, TopAppBar internal (TopBar와 오인하지 않게) * Update TopAppBar.kt * topappbar는 topbar 패키지로 * conflict 제거 * Revert "conflict 제거" This reverts commit 51c006d1d4ed9e4189d40e3a2f76b5ef8d3880eb. * 버전업 * 바텀바 제거 (BottomBar 브랜치에 있어야함) * Update BottomBar.kt --- .../design/system/compose/base/YdsScaffold.kt | 3 +- .../system/compose/component/BottomBar.kt | 1 + .../{ => topbar}/DoubleTitleTopBar.kt | 6 +- .../component/{ => topbar}/SearchTopBar.kt | 6 +- .../{ => topbar}/SingleTitleTopBar.kt | 6 +- .../compose/component/topbar/TopAppBar.kt | 65 +++++++++++++++++++ .../compose/component/{ => topbar}/TopBar.kt | 6 +- version.properties | 2 +- 8 files changed, 72 insertions(+), 23 deletions(-) rename compose/src/main/java/com/yourssu/design/system/compose/component/{ => topbar}/DoubleTitleTopBar.kt (93%) rename compose/src/main/java/com/yourssu/design/system/compose/component/{ => topbar}/SearchTopBar.kt (94%) rename compose/src/main/java/com/yourssu/design/system/compose/component/{ => topbar}/SingleTitleTopBar.kt (92%) create mode 100644 compose/src/main/java/com/yourssu/design/system/compose/component/topbar/TopAppBar.kt rename compose/src/main/java/com/yourssu/design/system/compose/component/{ => topbar}/TopBar.kt (93%) diff --git a/compose/src/main/java/com/yourssu/design/system/compose/base/YdsScaffold.kt b/compose/src/main/java/com/yourssu/design/system/compose/base/YdsScaffold.kt index c6078842..92963aef 100644 --- a/compose/src/main/java/com/yourssu/design/system/compose/base/YdsScaffold.kt +++ b/compose/src/main/java/com/yourssu/design/system/compose/base/YdsScaffold.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -21,7 +20,7 @@ import com.yourssu.design.system.compose.R import com.yourssu.design.system.compose.YdsTheme import com.yourssu.design.system.compose.atom.BoxButton import com.yourssu.design.system.compose.atom.TopBarButton -import com.yourssu.design.system.compose.component.TopBar +import com.yourssu.design.system.compose.component.topbar.TopBar import com.yourssu.design.system.compose.component.toast.ToastDuration import com.yourssu.design.system.compose.component.toast.ToastHost import com.yourssu.design.system.compose.component.toast.ToastHostState diff --git a/compose/src/main/java/com/yourssu/design/system/compose/component/BottomBar.kt b/compose/src/main/java/com/yourssu/design/system/compose/component/BottomBar.kt index f4bdb0a6..28a93b50 100644 --- a/compose/src/main/java/com/yourssu/design/system/compose/component/BottomBar.kt +++ b/compose/src/main/java/com/yourssu/design/system/compose/component/BottomBar.kt @@ -48,6 +48,7 @@ import com.yourssu.design.system.compose.base.IconSize import com.yourssu.design.system.compose.base.Surface import com.yourssu.design.system.compose.base.YdsScaffold import com.yourssu.design.system.compose.base.YdsText +import com.yourssu.design.system.compose.component.topbar.TopBar import com.yourssu.design.system.compose.rule.YdsInAndOutEasing /** diff --git a/compose/src/main/java/com/yourssu/design/system/compose/component/DoubleTitleTopBar.kt b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/DoubleTitleTopBar.kt similarity index 93% rename from compose/src/main/java/com/yourssu/design/system/compose/component/DoubleTitleTopBar.kt rename to compose/src/main/java/com/yourssu/design/system/compose/component/topbar/DoubleTitleTopBar.kt index 10466f2d..ddca7747 100644 --- a/compose/src/main/java/com/yourssu/design/system/compose/component/DoubleTitleTopBar.kt +++ b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/DoubleTitleTopBar.kt @@ -1,4 +1,4 @@ -package com.yourssu.design.system.compose.component +package com.yourssu.design.system.compose.component.topbar import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -31,9 +30,6 @@ fun DoubleTitleTopBar( modifier = modifier .fillMaxWidth() .height(72.dp), - backgroundColor = YdsTheme.colors.bgElevated, - contentColor = YdsTheme.colors.textPrimary, - elevation = 0.dp, contentPadding = PaddingValues(end = 4.dp) ) { Box( diff --git a/compose/src/main/java/com/yourssu/design/system/compose/component/SearchTopBar.kt b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/SearchTopBar.kt similarity index 94% rename from compose/src/main/java/com/yourssu/design/system/compose/component/SearchTopBar.kt rename to compose/src/main/java/com/yourssu/design/system/compose/component/topbar/SearchTopBar.kt index aa9cd1a7..e5369b69 100644 --- a/compose/src/main/java/com/yourssu/design/system/compose/component/SearchTopBar.kt +++ b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/SearchTopBar.kt @@ -1,4 +1,4 @@ -package com.yourssu.design.system.compose.component +package com.yourssu.design.system.compose.component.topbar import android.widget.Toast import androidx.compose.foundation.interaction.MutableInteractionSource @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -42,9 +41,6 @@ fun SearchTopBar( modifier = modifier .fillMaxWidth() .height(56.dp), - backgroundColor = YdsTheme.colors.bgElevated, - contentColor = YdsTheme.colors.textPrimary, - elevation = 0.dp, contentPadding = PaddingValues(start = 4.dp), ) { Box( diff --git a/compose/src/main/java/com/yourssu/design/system/compose/component/SingleTitleTopBar.kt b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/SingleTitleTopBar.kt similarity index 92% rename from compose/src/main/java/com/yourssu/design/system/compose/component/SingleTitleTopBar.kt rename to compose/src/main/java/com/yourssu/design/system/compose/component/topbar/SingleTitleTopBar.kt index 43957579..1bb92e2f 100644 --- a/compose/src/main/java/com/yourssu/design/system/compose/component/SingleTitleTopBar.kt +++ b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/SingleTitleTopBar.kt @@ -1,4 +1,4 @@ -package com.yourssu.design.system.compose.component +package com.yourssu.design.system.compose.component.topbar import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.PaddingValues @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.material.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -31,9 +30,6 @@ fun SingleTitleTopBar( modifier = modifier .fillMaxWidth() .height(56.dp), - backgroundColor = YdsTheme.colors.bgElevated, - contentColor = YdsTheme.colors.textPrimary, - elevation = 0.dp, contentPadding = PaddingValues(end = 4.dp) ) { Box( diff --git a/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/TopAppBar.kt b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/TopAppBar.kt new file mode 100644 index 00000000..9f83b801 --- /dev/null +++ b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/TopAppBar.kt @@ -0,0 +1,65 @@ +package com.yourssu.design.system.compose.component.topbar + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.RowScope +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.RectangleShape +import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.unit.dp +import com.yourssu.design.system.compose.YdsTheme +import com.yourssu.design.system.compose.base.Surface + +@Composable +internal fun TopAppBar( + modifier: Modifier = Modifier, + backgroundColor: Color = YdsTheme.colors.bgElevated, + contentColor: Color = YdsTheme.colors.textPrimary, + contentPadding: PaddingValues, + content: @Composable RowScope.() -> Unit, +) { + AppBar( + backgroundColor, + contentColor, + contentPadding, + RectangleShape, + modifier = modifier, + content = content, + ) +} + +@Composable +private fun AppBar( + backgroundColor: Color, + contentColor: Color, + contentPadding: PaddingValues, + shape: Shape, + modifier: Modifier = Modifier, + content: @Composable RowScope.() -> Unit, +) { + Surface( + color = backgroundColor, + contentColor = contentColor, + shape = shape, + modifier = modifier, + ) { + Row( + Modifier + .fillMaxWidth() + .padding(contentPadding) + .height(AppBarHeight), + horizontalArrangement = Arrangement.Start, + verticalAlignment = Alignment.CenterVertically, + content = content, + ) + } +} + +private val AppBarHeight = 56.dp diff --git a/compose/src/main/java/com/yourssu/design/system/compose/component/TopBar.kt b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/TopBar.kt similarity index 93% rename from compose/src/main/java/com/yourssu/design/system/compose/component/TopBar.kt rename to compose/src/main/java/com/yourssu/design/system/compose/component/topbar/TopBar.kt index 0ba4953c..6ae82c6d 100644 --- a/compose/src/main/java/com/yourssu/design/system/compose/component/TopBar.kt +++ b/compose/src/main/java/com/yourssu/design/system/compose/component/topbar/TopBar.kt @@ -1,4 +1,4 @@ -package com.yourssu.design.system.compose.component +package com.yourssu.design.system.compose.component.topbar import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.PaddingValues @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -31,9 +30,6 @@ fun TopBar( modifier = modifier .fillMaxWidth() .height(56.dp), - backgroundColor = YdsTheme.colors.bgElevated, - contentColor = YdsTheme.colors.textPrimary, - elevation = 0.dp, contentPadding = PaddingValues(horizontal = 4.dp) ) { Box( diff --git a/version.properties b/version.properties index 2074e8c6..32dafcc4 100644 --- a/version.properties +++ b/version.properties @@ -1,2 +1,2 @@ -versionName=2.5.0 +versionName=2.5.1 #자동 배포를 위해서 버전은 여기 한 군데에서 관리하면 된다