-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from team-haribo/feature/40-publishing-late-list
🔀 :: (#40) - publishing late list
- Loading branch information
Showing
11 changed files
with
450 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...gn-system/src/main/java/com/goms/design_system/component/bottomsheet/BottomSheetHeader.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.goms.design_system.component.bottomsheet | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import com.goms.design_system.component.modifier.gomsClickable | ||
import com.goms.design_system.icon.CloseIcon | ||
import com.goms.design_system.theme.GomsTheme | ||
|
||
@Composable | ||
fun BottomSheetHeader( | ||
modifier: Modifier, | ||
title: String, | ||
closeSheet: () -> Unit | ||
) { | ||
GomsTheme { colors, typography -> | ||
Row( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.height(32.dp), | ||
horizontalArrangement = Arrangement.SpaceBetween, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Text( | ||
text = title, | ||
style = typography.titleSmall, | ||
fontWeight = FontWeight.Bold, | ||
color = colors.WHITE | ||
) | ||
CloseIcon( | ||
modifier = Modifier.gomsClickable { closeSheet() }, | ||
tint = colors.WHITE | ||
) | ||
} | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...ystem/src/main/java/com/goms/design_system/component/bottomsheet/DatePickerBottomSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.goms.design_system.component.bottomsheet | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.BottomSheetDefaults | ||
import androidx.compose.material3.DatePicker | ||
import androidx.compose.material3.DatePickerDefaults | ||
import androidx.compose.material3.DatePickerState | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.ModalBottomSheet | ||
import androidx.compose.material3.rememberModalBottomSheetState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.unit.dp | ||
import com.goms.design_system.theme.GomsTheme | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun DatePickerBottomSheet( | ||
state: DatePickerState, | ||
closeSheet: () -> Unit | ||
) { | ||
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) | ||
|
||
GomsTheme { colors, typography -> | ||
ModalBottomSheet( | ||
onDismissRequest = closeSheet, | ||
sheetState = sheetState, | ||
shape = RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp), | ||
containerColor = colors.G1, | ||
dragHandle = { BottomSheetDefaults.DragHandle() }, | ||
) { | ||
Column(modifier = Modifier.fillMaxWidth()) { | ||
BottomSheetHeader( | ||
modifier = Modifier.padding(horizontal = 20.dp), | ||
title = "날짜 선택", | ||
closeSheet = closeSheet | ||
) | ||
DatePicker( | ||
state = state, | ||
showModeToggle = false, | ||
title = null, | ||
headline = null, | ||
colors = DatePickerDefaults.colors( | ||
containerColor = colors.G1, | ||
weekdayContentColor = colors.G4, | ||
navigationContentColor = colors.WHITE, | ||
yearContentColor = colors.WHITE, | ||
disabledYearContentColor = colors.WHITE, | ||
currentYearContentColor = colors.WHITE, | ||
selectedYearContentColor = colors.WHITE, | ||
dayContentColor = colors.WHITE, | ||
disabledDayContentColor = colors.WHITE, | ||
selectedDayContentColor = Color.White, | ||
disabledSelectedDayContentColor = colors.WHITE, | ||
selectedDayContainerColor = colors.A7, | ||
disabledSelectedDayContainerColor = colors.G1, | ||
todayDateBorderColor = colors.A7 | ||
) | ||
) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
core/design-system/src/main/java/com/goms/design_system/util/getDefaultWednesday.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.goms.design_system.util | ||
|
||
import java.time.DayOfWeek | ||
import java.time.Instant | ||
import java.time.LocalDate | ||
import java.time.ZoneId | ||
import java.time.temporal.TemporalAdjusters | ||
|
||
fun getDefaultWednesday(): Instant { | ||
val currentDate = LocalDate.now() | ||
|
||
return if (currentDate.dayOfWeek != DayOfWeek.WEDNESDAY) { | ||
val lastWednesday = currentDate.with(TemporalAdjusters.previous(DayOfWeek.WEDNESDAY)) | ||
lastWednesday.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant() | ||
} else { | ||
currentDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant() | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
feature/main/src/main/java/com/goms/main/LateListScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package com.goms.main | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.gestures.detectTapGestures | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.navigationBarsPadding | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.statusBarsPadding | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.text.KeyboardOptions | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.rememberDatePickerState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.input.pointer.pointerInput | ||
import androidx.compose.ui.platform.LocalFocusManager | ||
import androidx.compose.ui.text.input.KeyboardType | ||
import androidx.compose.ui.unit.dp | ||
import com.goms.design_system.component.bottomsheet.DatePickerBottomSheet | ||
import com.goms.design_system.component.button.GomsBackButton | ||
import com.goms.design_system.component.modifier.gomsClickable | ||
import com.goms.design_system.component.textfield.GomsSearchTextField | ||
import com.goms.design_system.theme.GomsTheme | ||
import com.goms.design_system.util.getDefaultWednesday | ||
import com.goms.design_system.util.keyboardAsState | ||
import com.goms.main.component.LateList | ||
import com.goms.main.component.LateListText | ||
import java.time.Instant | ||
import java.time.ZoneId | ||
|
||
@Composable | ||
fun LateListRoute( | ||
onBackClick: () -> Unit | ||
) { | ||
LateListScreen( | ||
onBackClick = onBackClick | ||
) | ||
} | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun LateListScreen( | ||
onBackClick: () -> Unit, | ||
) { | ||
val scrollState = rememberScrollState() | ||
val focusManager = LocalFocusManager.current | ||
val isKeyboardOpen by keyboardAsState() | ||
val datePickerState = rememberDatePickerState() | ||
var onDatePickerBottomSheetOpenClick by remember { mutableStateOf(false) } | ||
val selectedDate = Instant.ofEpochMilli(datePickerState.selectedDateMillis ?: getDefaultWednesday().toEpochMilli()) | ||
.atZone(ZoneId.systemDefault()) | ||
.toLocalDate() | ||
|
||
LaunchedEffect(isKeyboardOpen) { | ||
if (!isKeyboardOpen) { | ||
focusManager.clearFocus() | ||
} | ||
} | ||
|
||
GomsTheme { colors, typography -> | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(colors.BLACK) | ||
.statusBarsPadding() | ||
.navigationBarsPadding() | ||
.pointerInput(Unit) { | ||
detectTapGestures { | ||
focusManager.clearFocus() | ||
} | ||
} | ||
) { | ||
GomsBackButton { | ||
onBackClick() | ||
} | ||
Column( | ||
modifier = Modifier | ||
.verticalScroll(scrollState) | ||
.padding(horizontal = 20.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
LateListText(modifier = Modifier.align(Alignment.Start)) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
LateList( | ||
onBottomSheetOpenClick = { onDatePickerBottomSheetOpenClick = true } | ||
) | ||
} | ||
} | ||
if (onDatePickerBottomSheetOpenClick) { | ||
DatePickerBottomSheet( | ||
state = datePickerState, | ||
closeSheet = { onDatePickerBottomSheetOpenClick = false } | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
feature/main/src/main/java/com/goms/main/component/FilterText.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.goms.main.component | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import com.goms.design_system.component.modifier.gomsClickable | ||
import com.goms.design_system.theme.GomsTheme | ||
|
||
@Composable | ||
fun FilterText(onFilterTextClick: () -> Unit) { | ||
GomsTheme { colors, typography -> | ||
Box( | ||
modifier = Modifier | ||
.height(40.dp) | ||
.gomsClickable { onFilterTextClick() } | ||
) { | ||
Text( | ||
modifier = Modifier.align(Alignment.Center), | ||
text = "필터", | ||
style = typography.buttonLarge, | ||
fontWeight = FontWeight.Normal, | ||
color = colors.I5 | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.