Skip to content

Commit

Permalink
[Improve] TopAppBar 제작 (#242)
Browse files Browse the repository at this point in the history
* 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 51c006d.

* 버전업

* 바텀바 제거 (BottomBar 브랜치에 있어야함)

* Update BottomBar.kt
  • Loading branch information
Gael-Android authored Jan 15, 2024
1 parent ac10e2f commit c676bcb
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
versionName=2.5.0
versionName=2.5.1
#자동 배포를 위해서 버전은 여기 한 군데에서 관리하면 된다

0 comments on commit c676bcb

Please sign in to comment.