Skip to content

Commit

Permalink
refactor: 피드백 반영 (화면 별 분리)
Browse files Browse the repository at this point in the history
  • Loading branch information
syb8200 committed Jan 18, 2024
1 parent 9aaa087 commit 25d7c35
Show file tree
Hide file tree
Showing 9 changed files with 560 additions and 206 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ import com.susu.core.designsystem.component.button.MediumButtonStyle
import com.susu.core.designsystem.component.button.SusuFilledButton
import com.susu.core.designsystem.theme.SusuTheme
import com.susu.core.ui.extension.susuDefaultAnimatedContentTransitionSpec
import com.susu.feature.envelopeadd.content.CategoryContent
import com.susu.feature.envelopeadd.content.DateContent
import com.susu.feature.envelopeadd.content.InputContent
import com.susu.feature.envelopeadd.content.EventContent
import com.susu.feature.envelopeadd.content.MemoContent
import com.susu.feature.envelopeadd.content.MoneyContent
import com.susu.feature.envelopeadd.content.MoreContent
import com.susu.feature.envelopeadd.content.NameContent
import com.susu.feature.envelopeadd.content.PhoneContent
import com.susu.feature.envelopeadd.content.PresentContent
import com.susu.feature.envelopeadd.content.RelationshipContent
import com.susu.feature.envelopeadd.content.VisitedContent
import com.susu.feature.sent.R

enum class EnvelopeAddStep {
Expand Down Expand Up @@ -76,7 +82,7 @@ fun SentEnvelopeAddScreen(
onClickNext: () -> Unit = {},
) {
// TODO: 수정 필요
val categoryList = listOf("친구", "가족", "친척", "동료", "직접 입력")
val relationshipList = listOf("친구", "가족", "친척", "동료", "직접 입력")
val friendList = listOf("김철수", "국영수", "신짱구", "홍길동")
val eventList = listOf("결혼식", "돌잔치", "장례식", "생일 기념일", "직접 입력")
val moreList = listOf("방문여부", "선물", "메모", "보낸 이의 연락처")
Expand Down Expand Up @@ -108,52 +114,18 @@ fun SentEnvelopeAddScreen(
) { targetState ->
when (targetState) {
EnvelopeAddStep.MONEY -> MoneyContent()
EnvelopeAddStep.NAME -> InputContent(
titleText = stringResource(R.string.sent_envelope_add_name_title),
placeholder = stringResource(R.string.sent_envelope_add_name_placeholder),
friendList = friendList,
)

EnvelopeAddStep.RELATIONSHIP -> CategoryContent(
titleText = stringResource(R.string.sent_envelope_add_relationship_title),
categoryList = categoryList,
)

EnvelopeAddStep.EVENT -> CategoryContent(
titleText = stringResource(R.string.sent_envelope_add_event_title),
categoryList = eventList,
)

EnvelopeAddStep.DATE -> DateContent(
name = "김철수",
)

EnvelopeAddStep.MORE -> CategoryContent(
titleText = stringResource(R.string.sent_envelope_add_more_title),
categoryList = moreList,
subTitleText = stringResource(R.string.sent_envelope_add_more_subtitle),
)

EnvelopeAddStep.VISITED -> CategoryContent(
titleText = stringResource(R.string.sent_envelope_add_visited_title),
categoryList = visitedList,
)

EnvelopeAddStep.PRESENT -> InputContent(
titleText = stringResource(R.string.sent_envelope_add_present_title),
placeholder = stringResource(R.string.sent_envelope_add_present_placeholder),
)

EnvelopeAddStep.PHONE -> InputContent(
titleText = stringResource(R.string.sent_envelope_add_phone_title),
placeholder = stringResource(R.string.sent_envelope_add_phone_placeholder),
name = "김철수",
)

EnvelopeAddStep.MEMO -> InputContent(
titleText = stringResource(R.string.sent_envelope_add_memo_title),
placeholder = stringResource(R.string.sent_envelope_add_memo_placeholder),
EnvelopeAddStep.NAME -> NameContent(friendList = friendList)
EnvelopeAddStep.RELATIONSHIP -> RelationshipContent(relationshipList = relationshipList)
EnvelopeAddStep.EVENT -> EventContent(eventList = eventList)
EnvelopeAddStep.DATE -> DateContent(name = "김철수")
EnvelopeAddStep.MORE -> MoreContent(moreList = moreList)
EnvelopeAddStep.VISITED -> VisitedContent(
event = "결혼식",
visitedList = visitedList,
)
EnvelopeAddStep.PRESENT -> PresentContent()
EnvelopeAddStep.PHONE -> PhoneContent(name = "김철수")
EnvelopeAddStep.MEMO -> MemoContent()
}
}
SusuFilledButton(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package com.susu.feature.envelopeadd.content

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
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.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.susu.core.designsystem.component.button.FilledButtonColor
import com.susu.core.designsystem.component.button.GhostButtonColor
import com.susu.core.designsystem.component.button.MediumButtonStyle
import com.susu.core.designsystem.component.button.SusuFilledButton
import com.susu.core.designsystem.component.button.SusuGhostButton
import com.susu.core.designsystem.theme.Gray100
import com.susu.core.designsystem.theme.SusuTheme
import com.susu.feature.sent.R

@Composable
fun EventContent(
modifier: Modifier = Modifier,
padding: PaddingValues = PaddingValues(
horizontal = SusuTheme.spacing.spacing_m,
vertical = SusuTheme.spacing.spacing_xl,
),
eventList: List<String>,
) {
val scrollState = rememberScrollState()
var selectedItem by remember { mutableStateOf(-1) }

Column(
modifier = modifier
.fillMaxSize()
.padding(padding)
.verticalScroll(scrollState),
) {
Text(
text = stringResource(id = R.string.sent_envelope_add_relationship_title),
style = SusuTheme.typography.title_m,
color = Gray100,
)
Spacer(
modifier = modifier
.size(SusuTheme.spacing.spacing_xxl),
)
Column(
verticalArrangement = Arrangement.spacedBy(SusuTheme.spacing.spacing_xxs),
) {
eventList.forEachIndexed { index, event ->
if (selectedItem == index) {
SusuFilledButton(
color = FilledButtonColor.Orange,
style = MediumButtonStyle.height60,
text = event,
onClick = {
selectedItem = index
},
modifier = modifier.fillMaxWidth(),
)
} else {
SusuGhostButton(
color = GhostButtonColor.Black,
style = MediumButtonStyle.height60,
text = event,
onClick = {
selectedItem = index
},
modifier = modifier.fillMaxWidth(),
)
}
}
}
}
}

@Preview(showBackground = true, backgroundColor = 0xFFF6F6F6)
@Composable
fun EventContentPreview() {
val eventList = mutableListOf("결혼식", "돌잔치", "장례식", "생일 기념일", "직접 입력")

SusuTheme {
EventContent(eventList = eventList)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.susu.feature.envelopeadd.content

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.susu.core.designsystem.component.textfield.SusuBasicTextField
import com.susu.core.designsystem.theme.Gray100
import com.susu.core.designsystem.theme.Gray40
import com.susu.core.designsystem.theme.SusuTheme
import com.susu.feature.sent.R

@Composable
fun MemoContent(
modifier: Modifier = Modifier,
padding: PaddingValues = PaddingValues(
horizontal = SusuTheme.spacing.spacing_m,
vertical = SusuTheme.spacing.spacing_xl,
),
) {
var memo by remember { mutableStateOf("") }

Column(
modifier = modifier
.fillMaxSize()
.padding(padding),
) {
Text(
text = stringResource(id = R.string.sent_envelope_add_memo_title),
style = SusuTheme.typography.title_m,
color = Gray100,
)
Spacer(
modifier = modifier
.size(SusuTheme.spacing.spacing_m),
)
SusuBasicTextField(
text = memo,
onTextChange = { memo = it },
placeholder = stringResource(id = R.string.sent_envelope_add_memo_placeholder),
placeholderColor = Gray40,
modifier = modifier.fillMaxWidth(),
)
Spacer(modifier = modifier.size(SusuTheme.spacing.spacing_xl))
}
}

@Preview(showBackground = true, backgroundColor = 0xFFF6F6F6)
@Composable
fun MemoContentPreview() {
SusuTheme {
MemoContent()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package com.susu.feature.envelopeadd.content

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
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.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.susu.core.designsystem.component.button.FilledButtonColor
import com.susu.core.designsystem.component.button.GhostButtonColor
import com.susu.core.designsystem.component.button.MediumButtonStyle
import com.susu.core.designsystem.component.button.SusuFilledButton
import com.susu.core.designsystem.component.button.SusuGhostButton
import com.susu.core.designsystem.theme.Gray100
import com.susu.core.designsystem.theme.Gray70
import com.susu.core.designsystem.theme.SusuTheme
import com.susu.feature.sent.R

@Composable
fun MoreContent(
modifier: Modifier = Modifier,
padding: PaddingValues = PaddingValues(
horizontal = SusuTheme.spacing.spacing_m,
vertical = SusuTheme.spacing.spacing_xl,
),
moreList: List<String>,
) {
val scrollState = rememberScrollState()
var selectedItem by remember { mutableStateOf(-1) }

Column(
modifier = modifier
.fillMaxSize()
.padding(padding)
.verticalScroll(scrollState),
) {
Text(
text = stringResource(id = R.string.sent_envelope_add_more_title),
style = SusuTheme.typography.title_m,
color = Gray100,
)
Spacer(
modifier = modifier
.size(SusuTheme.spacing.spacing_xxxxs),
)
Text(
text = stringResource(id = R.string.sent_envelope_add_more_subtitle),
style = SusuTheme.typography.text_xs,
color = Gray70,
)
Spacer(
modifier = modifier
.size(SusuTheme.spacing.spacing_xxl),
)
Column(
verticalArrangement = Arrangement.spacedBy(SusuTheme.spacing.spacing_xxs),
) {
moreList.forEachIndexed { index, category ->
if (selectedItem == index) {
SusuFilledButton(
color = FilledButtonColor.Orange,
style = MediumButtonStyle.height60,
text = category,
onClick = {
selectedItem = index
},
modifier = modifier.fillMaxWidth(),
)
} else {
SusuGhostButton(
color = GhostButtonColor.Black,
style = MediumButtonStyle.height60,
text = category,
onClick = {
selectedItem = index
},
modifier = modifier.fillMaxWidth(),
)
}
}
}
}
}

@Preview(showBackground = true, backgroundColor = 0xFFF6F6F6)
@Composable
fun MoreContentPreview() {
val moreList = mutableListOf("방문여부", "선물", "메모", "받은 이의 연락처")

SusuTheme {
MoreContent(moreList = moreList)
}
}
Loading

0 comments on commit 25d7c35

Please sign in to comment.