diff --git a/feature/received/src/main/java/com/susu/feature/received/ledgeradd/content/DateContent.kt b/feature/received/src/main/java/com/susu/feature/received/ledgeradd/content/DateContent.kt index b3e23271..8d999704 100644 --- a/feature/received/src/main/java/com/susu/feature/received/ledgeradd/content/DateContent.kt +++ b/feature/received/src/main/java/com/susu/feature/received/ledgeradd/content/DateContent.kt @@ -5,17 +5,19 @@ 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.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview -import com.susu.core.designsystem.theme.Gray80 +import androidx.compose.ui.unit.dp +import com.susu.core.designsystem.component.bottomsheet.datepicker.SusuDatePickerBottomSheet import com.susu.core.designsystem.theme.SusuTheme -import com.susu.core.ui.util.AnnotatedText import com.susu.feature.received.R +import com.susu.feature.received.ledgeradd.content.component.SelectDateRow -// TODO 디자인 변경 예정 +@OptIn(ExperimentalMaterial3Api::class) @Composable fun DateContent() { Column( @@ -27,34 +29,26 @@ fun DateContent() { end = SusuTheme.spacing.spacing_m, ), ) { + // TODO Annotated Text 사용 Text( - text = "경조사 기간을 입력해주세요", + text = "고모부의 장례식은 언제인가요", style = SusuTheme.typography.title_m, ) Spacer(modifier = Modifier.size(SusuTheme.spacing.spacing_m)) - AnnotatedText( - originalText = stringResource(R.string.ledger_edit_screen_from_date, 2023, 11, 25), - targetTextList = listOf( - stringResource(R.string.ledger_edit_screen_year), - stringResource(R.string.ledger_edit_screen_month), - stringResource(R.string.ledger_edit_screen_from_day), - ), - originalTextStyle = SusuTheme.typography.title_xl, - spanStyle = SusuTheme.typography.title_xl.copy(Gray80).toSpanStyle(), + SelectDateRow( + suffix = stringResource(R.string.ledger_add_screen_from), ) - AnnotatedText( - originalText = stringResource(R.string.ledger_edit_screen_until_date, 2023, 11, 25), - targetTextList = listOf( - stringResource(R.string.ledger_edit_screen_year), - stringResource(R.string.ledger_edit_screen_month), - stringResource(R.string.ledger_edit_screen_until_day), - ), - originalTextStyle = SusuTheme.typography.title_xl, - spanStyle = SusuTheme.typography.title_xl.copy(Gray80).toSpanStyle(), + + Spacer(modifier = Modifier.size(SusuTheme.spacing.spacing_xxs)) + + SelectDateRow( + suffix = stringResource(R.string.ledger_add_screen_until), ) } + + SusuDatePickerBottomSheet(maximumContainerHeight = 346.dp) } @Preview(showBackground = true, backgroundColor = 0xFFF6F6F6) diff --git a/feature/received/src/main/java/com/susu/feature/received/ledgeradd/content/component/SelectDateRow.kt b/feature/received/src/main/java/com/susu/feature/received/ledgeradd/content/component/SelectDateRow.kt new file mode 100644 index 00000000..0bf71509 --- /dev/null +++ b/feature/received/src/main/java/com/susu/feature/received/ledgeradd/content/component/SelectDateRow.kt @@ -0,0 +1,69 @@ +package com.susu.feature.received.ledgeradd.content.component + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import com.susu.core.designsystem.theme.Gray30 +import com.susu.core.designsystem.theme.SusuTheme +import com.susu.core.ui.util.AnnotatedText +import com.susu.feature.received.R +import java.time.LocalDateTime + +private val currentDate = LocalDateTime.now() + +@Composable +fun SelectDateRow( + year: Int? = null, + month: Int? = null, + day: Int? = null, + suffix: String? = null, +) { + Row( + horizontalArrangement = Arrangement.spacedBy(SusuTheme.spacing.spacing_xxs), + verticalAlignment = Alignment.Bottom, + ) { + if (year == null || month == null || day == null) { + AnnotatedText( + originalText = stringResource( + R.string.ledger_add_screen_date, + currentDate.year, + currentDate.month.value, + currentDate.dayOfMonth, + ), + targetTextList = listOf( + currentDate.year.toString(), + currentDate.month.value.toString(), + currentDate.dayOfMonth.toString(), + ), + originalTextStyle = SusuTheme.typography.title_xl, + spanStyle = SusuTheme.typography.title_xl.copy(Gray30).toSpanStyle(), + ) + } else { + Text( + text = stringResource( + R.string.ledger_add_screen_date, + year, + month, + day, + ), + style = SusuTheme.typography.title_xl, + ) + } + + if (suffix != null) { + Text(text = suffix, style = SusuTheme.typography.title_l) + } + } +} + +@Preview +@Composable +fun SelectDateRowPreview() { + SusuTheme { + SelectDateRow() + } +} diff --git a/feature/received/src/main/res/values/strings.xml b/feature/received/src/main/res/values/strings.xml index b257ed52..8138a771 100644 --- a/feature/received/src/main/res/values/strings.xml +++ b/feature/received/src/main/res/values/strings.xml @@ -18,4 +18,7 @@ 경조사명을 알려주세요 경조사명을 입력해주세요 어떤 경조사였나요 + %d년 %d월 %d일 + 까지 + 부터