From 854fa3cddf8c258b9c9f8e32e3eff9348bb355a9 Mon Sep 17 00:00:00 2001 From: MinseoShindor Date: Sun, 4 Feb 2024 07:35:52 +0900 Subject: [PATCH] =?UTF-8?q?[feat/#76]=20=EC=B6=9C=EC=84=9D=20=ED=98=84?= =?UTF-8?q?=ED=99=A9=20=EC=95=84=EC=9D=B4=ED=85=9C=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/home/attend/curriItem.kt | 78 ++++++++++++++++--- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/presentation/src/main/java/com/kusitms/presentation/ui/home/attend/curriItem.kt b/presentation/src/main/java/com/kusitms/presentation/ui/home/attend/curriItem.kt index 41fdc50..db544a8 100644 --- a/presentation/src/main/java/com/kusitms/presentation/ui/home/attend/curriItem.kt +++ b/presentation/src/main/java/com/kusitms/presentation/ui/home/attend/curriItem.kt @@ -1,18 +1,27 @@ package com.kusitms.presentation.ui.home.attend +import androidx.compose.foundation.background import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Icon +import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.modifier.modifierLocalMapOf +import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp +import com.kusitms.domain.model.home.AttendCurrentModel +import com.kusitms.presentation.common.ui.KusitmsMarginHorizontalSpacer import com.kusitms.presentation.common.ui.theme.KusitmsColorPalette +import com.kusitms.presentation.common.ui.theme.KusitmsTypo import com.kusitms.presentation.model.home.attend.AttendViewModel @Composable fun CurriItem( - status: AttendViewModel.Status + model: AttendCurrentModel ) { Row(modifier = Modifier .fillMaxWidth() @@ -20,35 +29,80 @@ fun CurriItem( horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - - + CurriTitleRow(model = model) + CurriBadge(model = model) } } @Composable -fun CurriTitleRow( - title: String, - date: String, - status: AttendViewModel.Status +fun CurriBadge( + model: AttendCurrentModel ) { + val status = AttendViewModel.Status.fromString(model.status) ?: AttendViewModel.Status.PRESENT val statusColor = when(status) { AttendViewModel.Status.PRESENT -> KusitmsColorPalette.current.Sub1 AttendViewModel.Status.ABSENT, AttendViewModel.Status.LATE -> KusitmsColorPalette.current.Sub2 - else -> "" + else -> KusitmsColorPalette.current.Grey600 + } + Column( + modifier = Modifier + .width(52.dp) + .fillMaxHeight(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(2.dp, Alignment.CenterVertically) + ) { + Box(modifier = Modifier + .width(52.dp) + .wrapContentHeight() + .background( + color = KusitmsColorPalette.current.Grey600, + shape = RoundedCornerShape(40.dp) + ) + ) { + Text(text = model.status, + style = KusitmsTypo.current.Text_Semibold, + color = statusColor, + modifier = Modifier.align(Alignment.Center) + ) + } + Text(text = model.time, + style = KusitmsTypo.current.Caption1, + color = KusitmsColorPalette.current.Grey400, + ) } +} + +@Composable +fun CurriTitleRow( + model: AttendCurrentModel +) { + val status = AttendViewModel.Status.fromString(model.status) ?: AttendViewModel.Status.PRESENT Row( modifier = Modifier .wrapContentWidth() .fillMaxHeight(), - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.Start, verticalAlignment = Alignment.CenterVertically ) { - status.toDrawable() + Icon( + painter = painterResource(id = status.toDrawable()), + contentDescription = "Status", + tint = Color.Unspecified + ) + KusitmsMarginHorizontalSpacer(size = 24) Column( + horizontalAlignment = Alignment.Start, + verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.CenterVertically) ) { - + Text(text = model.curriculum, + style = KusitmsTypo.current.Text_Semibold, + color = KusitmsColorPalette.current.Grey100, + ) + Text(text = model.date, + style = KusitmsTypo.current.Caption1, + color = KusitmsColorPalette.current.Grey400, + ) } } - } \ No newline at end of file