-
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.
[FEATURE]#74 : 예약된 쪽지 목록 common ui로 변경
- Loading branch information
1 parent
1a478b2
commit 37fed18
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
core/ui/src/main/kotlin/com/bff/wespot/ui/ReservedMessageItem.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.bff.wespot.ui | ||
|
||
import android.graphics.Color.parseColor | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.material3.FilterChip | ||
import androidx.compose.material3.FilterChipDefaults | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import coil.compose.AsyncImage | ||
import coil.request.ImageRequest | ||
import com.bff.wespot.designsystem.theme.StaticTypeScale | ||
import com.bff.wespot.designsystem.theme.WeSpotThemeManager | ||
import com.bff.wespot.model.message.response.Message | ||
|
||
@Composable | ||
fun ReservedMessageItem( | ||
reservedMessage: Message, | ||
chipText: String, | ||
chipEnabled: Boolean, | ||
chipDisabledText: String, | ||
onClick: () -> Unit, | ||
) { | ||
Column { | ||
Row( | ||
modifier = Modifier.padding(start = 18.dp, end = 18.dp, top = 12.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
val profile = reservedMessage.receiver.profileCharacter | ||
|
||
Box( | ||
modifier = Modifier | ||
.size(42.dp) | ||
.clip(CircleShape) | ||
.background( | ||
runCatching { | ||
Color(parseColor(profile.backgroundColor)) | ||
}.getOrDefault(WeSpotThemeManager.colors.cardBackgroundColor), | ||
), | ||
contentAlignment = Alignment.Center, | ||
) { | ||
AsyncImage( | ||
model = ImageRequest.Builder(LocalContext.current) | ||
.data(profile.iconUrl) | ||
.crossfade(true) | ||
.build(), | ||
contentDescription = stringResource(com.bff.wespot.ui.R.string.user_character_image), | ||
) | ||
} | ||
|
||
Column( | ||
modifier = Modifier | ||
.padding(horizontal = 10.dp) | ||
.weight(1f), | ||
) { | ||
Text( | ||
text = stringResource(com.bff.wespot.designsystem.R.string.letter_receiver), | ||
style = StaticTypeScale.Default.body6, | ||
color = WeSpotThemeManager.colors.txtSubColor, | ||
) | ||
|
||
Text( | ||
text = reservedMessage.receiver.toDescription(), | ||
style = StaticTypeScale.Default.body6, | ||
color = WeSpotThemeManager.colors.txtTitleColor, | ||
) | ||
} | ||
|
||
FilterChip( | ||
shape = WeSpotThemeManager.shapes.extraLarge, | ||
onClick = { onClick() }, | ||
selected = false, | ||
label = { | ||
Text( | ||
text = if (chipEnabled) chipText else chipDisabledText, | ||
style = StaticTypeScale.Default.body6, | ||
) | ||
}, | ||
enabled = chipEnabled, | ||
border = null, | ||
colors = FilterChipDefaults.filterChipColors( | ||
containerColor = WeSpotThemeManager.colors.secondaryBtnColor, | ||
labelColor = Color(0xFFF7F7F8), | ||
), | ||
) | ||
} | ||
|
||
HorizontalDivider( | ||
modifier = Modifier.padding(top = 24.dp, start = 24.dp, end = 24.dp), | ||
thickness = 1.dp, | ||
color = WeSpotThemeManager.colors.cardBackgroundColor, | ||
) | ||
} | ||
} |