Skip to content

Commit

Permalink
onCellClick의 dayName 인자 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
cometj03 committed Dec 5, 2022
1 parent dd74688 commit a04f501
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import kotlin.math.min
@Composable
fun ComposeTimeTable(
timeTableData: TimeTableData,
onCellClick: (ScheduleEntity) -> Unit,
onCellClick: (dayName: String, ScheduleEntity) -> Unit,
modifier: Modifier = Modifier,
) = ComposeTimeTable(
dayNames = timeTableData.dayNameList,
Expand All @@ -33,7 +33,7 @@ fun ComposeTimeTable(
fun ComposeTimeTable(
dayNames: List<String>,
timeTableData: TimeTableData,
onCellClick: (ScheduleEntity) -> Unit,
onCellClick: (dayName: String, ScheduleEntity) -> Unit,
modifier: Modifier = Modifier,
) {
val startHour = min(timeTableData.earliestStartHour, tableStartHour)
Expand Down Expand Up @@ -70,7 +70,7 @@ fun ComposeTimeTable(

TimeTableCell(
cellData = scheduleEntity,
onCellClick = onCellClick,
onCellClick = { entity -> onCellClick(dayNames[column], entity) },
modifier = Modifier
.padding(minBorderWidth)
.timeTableCell(
Expand Down Expand Up @@ -124,13 +124,12 @@ fun HoursLabelPreview() {
@Preview(widthDp = 300)
@Composable
fun TimeTablePreview() {
//val dayNames = listOf("월", "화", "수", "목", "금", "토", "일")
val scrollState = rememberScrollState()

Column {
ComposeTimeTable(
timeTableData = timeTableData,
onCellClick = {},
onCellClick = { _, _ -> Unit },
modifier = Modifier
.verticalScroll(scrollState)
.wrapContentSize()
Expand Down

0 comments on commit a04f501

Please sign in to comment.