Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/mz 195 received envelop detail UI #77

Merged
merged 3 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@
<string name="sns_google">ꡬ글</string>
<string name="word_enrollment">등둝</string>
<string name="money_unit_format">%s원</string>
<string name="word_yes">예</string>
<string name="word_no">μ•„λ‹ˆμš”</string>
<string name="word_phone_number">μ—°λ½μ²˜</string>
<string name="word_memo">λ©”λͺ¨</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ import com.susu.feature.mypage.navigation.navigateMyPage
import com.susu.feature.mypage.navigation.navigateMyPageInfo
import com.susu.feature.mypage.navigation.navigateMyPageSocial
import com.susu.feature.received.navigation.ReceivedRoute
import com.susu.feature.received.navigation.navigateEnvelopeAdd
import com.susu.feature.received.navigation.navigateLedgerAdd
import com.susu.feature.received.navigation.navigateLedgerDetail
import com.susu.feature.received.navigation.navigateLedgerEdit
import com.susu.feature.received.navigation.navigateLedgerFilter
import com.susu.feature.received.navigation.navigateLedgerSearch
import com.susu.feature.received.navigation.navigateReceived
import com.susu.feature.received.navigation.navigateReceivedEnvelopeAdd
import com.susu.feature.received.navigation.navigateReceivedEnvelopeDetail
import com.susu.feature.received.navigation.navigateReceivedEnvelopeEdit
import com.susu.feature.sent.navigation.SentRoute
import com.susu.feature.sent.navigation.navigateSent
import com.susu.feature.sent.navigation.navigateSentEnvelope
Expand Down Expand Up @@ -50,6 +52,8 @@ internal class MainNavigator(
in listOf(
ReceivedRoute.ledgerSearchRoute,
ReceivedRoute.ledgerFilterRoute,
ReceivedRoute.envelopeDetailRoute,
ReceivedRoute.envelopeEditRoute,
SentRoute.sentEnvelopeRoute,
SentRoute.sentEnvelopeDetailRoute,
SentRoute.sentEnvelopeEditRoute,
Expand Down Expand Up @@ -145,8 +149,16 @@ internal class MainNavigator(
navController.navigateMyPageSocial()
}

fun navigateEnvelopeAdd() {
navController.navigateEnvelopeAdd()
fun navigateReceivedEnvelopeAdd() {
navController.navigateReceivedEnvelopeAdd()
}

fun navigateReceivedEnvelopeDetail() {
navController.navigateReceivedEnvelopeDetail()
}

fun navigateReceivedEnvelopeEdit() {
navController.navigateReceivedEnvelopeEdit()
}

fun popBackStackIfNotHome() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ internal fun MainScreen(
navigateLedgerEdit = navigator::navigateLedgerEdit,
navigateLedgerFilter = navigator::navigateLedgerFilter,
navigateLedgerAdd = navigator::navigateLedgerAdd,
navigateEnvelopAdd = navigator::navigateEnvelopeAdd,
navigateEnvelopAdd = navigator::navigateReceivedEnvelopeAdd,
navigateEnvelopeDetail = navigator::navigateReceivedEnvelopeDetail,
navigateEnvelopeEdit = navigator::navigateReceivedEnvelopeEdit,
onShowSnackbar = viewModel::onShowSnackbar,
onShowDialog = viewModel::onShowDialog,
handleException = viewModel::handleException,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
package com.susu.feature.received.envelopedetail

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.susu.core.designsystem.component.appbar.SusuDefaultAppBar
import com.susu.core.designsystem.component.appbar.icon.BackIcon
import com.susu.core.designsystem.component.appbar.icon.DeleteText
import com.susu.core.designsystem.component.appbar.icon.EditText
import com.susu.core.designsystem.theme.Gray100
import com.susu.core.designsystem.theme.SusuTheme
import com.susu.feature.received.envelopedetail.component.DetailItem

@Composable
fun ReceivedEnvelopeDetailRoute(
@Suppress("detekt:UnusedParameter")
popBackStack: () -> Unit,
navigateReceivedEnvelopeEdit: () -> Unit,
) {
ReceivedEnvelopeDetailScreen(
onClickEdit = navigateReceivedEnvelopeEdit,
)
}

@Composable
fun ReceivedEnvelopeDetailScreen(
modifier: Modifier = Modifier,
onClickBackIcon: () -> Unit = {},
onClickEdit: () -> Unit = {},
onClickDelete: () -> Unit = {},
) {
val scrollState = rememberScrollState()

Box(
modifier = modifier
.background(SusuTheme.colorScheme.background10),
) {
Column {
SusuDefaultAppBar(
leftIcon = {
BackIcon(
onClick = onClickBackIcon,
)
},
actions = {
EditText(
onClick = onClickEdit,
)
Spacer(modifier = modifier.size(SusuTheme.spacing.spacing_m))
DeleteText(
onClick = onClickDelete,
)
Spacer(modifier = modifier.size(SusuTheme.spacing.spacing_m))
},
)
// TODO: text μˆ˜μ •
Column(
modifier = modifier
.fillMaxSize()
.padding(
start = SusuTheme.spacing.spacing_m,
end = SusuTheme.spacing.spacing_m,
top = SusuTheme.spacing.spacing_xl,
)
.verticalScroll(scrollState),
) {
Text(
text = "150,000원",
style = SusuTheme.typography.title_xxl,
color = Gray100,
)
Spacer(modifier = modifier.size(SusuTheme.spacing.spacing_m))
Column {
DetailItem(
categoryText = "이름",
contentText = "κΉ€μ² μˆ˜",
isEmptyContent = false,
)
DetailItem(
categoryText = "λ‚˜μ™€μ˜ 관계",
contentText = "친ꡬ",
isEmptyContent = false,
)
DetailItem(
categoryText = "λ°©λ¬Έ μ—¬λΆ€",
contentText = "예",
isEmptyContent = false,
)
DetailItem(
categoryText = "μ„ λ¬Ό",
contentText = "ν•œλΌ 식사",
isEmptyContent = false,
)
DetailItem(
categoryText = "μ—°λ½μ²˜",
contentText = "01012345678",
isEmptyContent = false,
)
DetailItem(
categoryText = "λ©”λͺ¨",
contentText = "κ°€λ‚˜λ‹€λΌλ§ˆλ°”μ‚¬μ•„μžμ°¨μΉ΄νƒ€νŒŒν•˜κ°€λ‚˜λ‹€λΌλ§ˆλ°”μ‚¬μ•„μžμ°¨μΉ΄νƒ€νŒŒν•˜κ°€λ‚˜λ‹€λΌλ§ˆλ°”μ‚¬μ•„μžμ°¨μΉ΄νƒ€νŒŒν•˜κ°€λ‚˜λ‹€λΌλ§ˆλ°”μ‚¬μ•„μžμ°¨μΉ΄νƒ€νŒŒν•˜κ°€λ‚˜λ‹€λΌλ§ˆλ°”μ‚¬μ•„μžμ°¨μΉ΄νƒ€νŒŒν•˜",
isEmptyContent = false,
)
}
}
}
}
}

@Preview
@Composable
fun ReceivedEnvelopeDetailScreenPreview() {
SusuTheme {
ReceivedEnvelopeDetailScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.susu.feature.received.envelopedetail.component

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Text
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.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.susu.core.designsystem.theme.Gray100
import com.susu.core.designsystem.theme.Gray60
import com.susu.core.designsystem.theme.SusuTheme

@Composable
fun DetailItem(
modifier: Modifier = Modifier,
categoryText: String,
categoryStyle: TextStyle = SusuTheme.typography.title_xxs,
categoryTextColor: Color = Gray60,
categoryWidth: Dp = 72.dp,
contentText: String,
contentStyle: TextStyle = SusuTheme.typography.title_s,
contentColor: Color = Gray100,
isEmptyContent: Boolean,
padding: PaddingValues = PaddingValues(vertical = SusuTheme.spacing.spacing_m),
) {
if (!isEmptyContent) {
Row(
modifier = modifier
.fillMaxWidth()
.padding(padding),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = categoryText,
style = categoryStyle,
color = categoryTextColor,
modifier = modifier
.width(categoryWidth)
.align(Alignment.Top),
)
Spacer(modifier = modifier.size(SusuTheme.spacing.spacing_m))
Text(
text = contentText,
style = contentStyle,
color = contentColor,
modifier = modifier.weight(1f),
)
}
}
}

@Preview(showBackground = true, backgroundColor = 0xffffff)
@Composable
fun DetailItem() {
SusuTheme {
DetailItem(
categoryText = "경쑰사",
contentText = "κ²°ν˜Όμ‹",
isEmptyContent = false,
)
}
}
Loading