Skip to content

Commit

Permalink
feat: 날짜 선택 ui 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jinukeu committed Jan 12, 2024
1 parent 06f79cf commit f2d88bd
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
}
}
3 changes: 3 additions & 0 deletions feature/received/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
<string name="input_name_screen_title">경조사명을 알려주세요</string>
<string name="input_name_screen_textfield_placeholder">경조사명을 입력해주세요</string>
<string name="select_category_screen_title">어떤 경조사였나요</string>
<string name="ledger_add_screen_date">%d년 %d월 %d일</string>
<string name="ledger_add_screen_until">까지</string>
<string name="ledger_add_screen_from">부터</string>
</resources>

0 comments on commit f2d88bd

Please sign in to comment.