Skip to content

Commit

Permalink
Merge pull request #291 from team-haribo/feature/290-change-the-date-…
Browse files Browse the repository at this point in the history
…to-appear-on-the-late-list

🔀 :: (#290) - change the date to appear on the late list
  • Loading branch information
diejdkll authored Jul 11, 2024
2 parents 933febb + 85a1d54 commit 780246f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.goms.design_system.util

import kotlinx.datetime.LocalDate
import java.time.format.TextStyle
import java.util.Locale

fun LocalDate.formatDate(): String {
val year = this.year
val month = this.monthNumber
val day = this.dayOfMonth

val dayOfWeek = this.dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN)

return "${year}${month}${day}일 ($dayOfWeek)"
}
1 change: 1 addition & 0 deletions feature/main/src/main/java/com/goms/main/LateListScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private fun LateListScreen(
GomsSpacer(size = SpacerSize.ExtraSmall)
LateList(
getLateListUiState = getLateListUiState,
localDate = selectedLocalDate,
onBottomSheetOpenClick = { onDatePickerBottomSheetOpenClick = true },
onErrorToast = onErrorToast
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ import com.goms.main.data.LateData
import com.goms.main.data.toData
import com.goms.main.viewmodel.uistate.GetLateListUiState
import com.goms.ui.toText
import kotlinx.datetime.LocalDate

@Composable
internal fun LateList(
modifier: Modifier = Modifier,
getLateListUiState: GetLateListUiState,
localDate: LocalDate,
onErrorToast: (throwable: Throwable?, message: Int?) -> Unit,
onBottomSheetOpenClick: () -> Unit
) {
Expand All @@ -55,7 +57,7 @@ internal fun LateList(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
SearchResultText(modifier = Modifier)
LocalDateText(date = localDate)
FilterText(onFilterTextClick = onBottomSheetOpenClick)
}
when (getLateListUiState) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.goms.main.component

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.font.FontWeight
import com.goms.design_system.theme.GomsTheme.colors
import com.goms.design_system.theme.GomsTheme.typography
import com.goms.design_system.util.formatDate
import kotlinx.datetime.LocalDate

@Composable
internal fun LocalDateText(date: LocalDate) {
Text(
text = date.formatDate(),
style = typography.textSmall,
fontWeight = FontWeight.SemiBold,
color = colors.WHITE
)
}

0 comments on commit 780246f

Please sign in to comment.