Skip to content

Commit

Permalink
update calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
avan1235 committed Mar 14, 2024
1 parent 70d16e5 commit 0c583ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface ShinComponent : Component {

fun onExtraElementsVisibleChange()

fun onExpirationDateTimeChange(expirationDate: LocalDate?): Boolean
fun onExpirationDateChange(expirationDate: LocalDate?): Boolean

fun onUrlChange(url: String)

Expand Down Expand Up @@ -72,7 +72,7 @@ class ShinComponentImpl(
_extraElementsVisible.update { !it }
}

override fun onExpirationDateTimeChange(expirationDate: LocalDate?): Boolean = when {
override fun onExpirationDateChange(expirationDate: LocalDate?): Boolean = when {
expirationDate == null -> {
val updatedDate = tomorrow
_expirationDate.update { updatedDate }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,19 @@ private fun ShortenRequestExtraElements(
enter = fadeIn() + expandVertically(expandFrom = Alignment.Top),
exit = shrinkVertically(shrinkTowards = Alignment.Top) + fadeOut()
) {
Box(
modifier = Modifier.sizeIn(maxWidth = 280.dp),
Column(
modifier = Modifier
.padding(top = 12.dp)
.sizeIn(maxWidth = 280.dp),
verticalArrangement = Arrangement.spacedBy(4.dp, alignment = Alignment.CenterVertically),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text("Expiration Date", style = MaterialTheme.typography.headlineSmall)
val calendarState = rememberSelectableCalendarState(
initialMonth = YearMonth.now(),
minMonth = YearMonth.now(),
initialSelection = listOf(expirationDate),
confirmSelectionChange = { component.onExpirationDateTimeChange(it.singleOrNull()) },
confirmSelectionChange = { component.onExpirationDateChange(it.singleOrNull()) },
)
SelectableCalendar(calendarState = calendarState)
}
Expand Down

0 comments on commit 0c583ec

Please sign in to comment.