Rework Preview for a better rendering in the IDE.

This commit is contained in:
Benoit Marty 2023-01-27 10:19:17 +01:00 committed by Benoit Marty
parent e3fed8b4f5
commit 9d32b05fbb
32 changed files with 452 additions and 73 deletions

View file

@ -42,6 +42,8 @@ import io.element.android.features.roomlist.model.RoomListRoomSummary
import io.element.android.features.roomlist.model.RoomListState
import io.element.android.features.roomlist.model.stubbedRoomSummaries
import io.element.android.libraries.designsystem.components.avatar.AvatarData
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
import io.element.android.libraries.designsystem.theme.components.ElementScaffold
import io.element.android.libraries.designsystem.utils.LogCompositions
import io.element.android.libraries.matrix.core.RoomId
@ -156,7 +158,14 @@ private fun RoomListRoomSummary.contentType() = isPlaceholder
@Preview
@Composable
fun RoomListViewPreview() {
fun RoomListViewLightPreview() = ElementPreviewLight { ContentToPreview() }
@Preview
@Composable
fun RoomListViewDarkPreview() = ElementPreviewDark { ContentToPreview() }
@Composable
private fun ContentToPreview() {
RoomListView(
roomSummaries = stubbedRoomSummaries(),
matrixUser = MatrixUser(id = UserId("@id"), username = "User#1", avatarData = AvatarData("U")),

View file

@ -115,10 +115,10 @@ internal fun DefaultRoomSummaryRow(
// Name
Text(
modifier = Modifier.placeholder(
visible = room.isPlaceholder,
shape = TextPlaceholderShape,
color = ElementTheme.colors.roomListPlaceHolder,
),
visible = room.isPlaceholder,
shape = TextPlaceholderShape,
color = ElementTheme.colors.roomListPlaceHolder,
),
fontSize = 16.sp,
fontWeight = FontWeight.SemiBold,
text = room.name,
@ -146,7 +146,11 @@ internal fun DefaultRoomSummaryRow(
.alignByBaseline(),
) {
Text(
modifier = Modifier.placeholder(room.isPlaceholder, shape = TextPlaceholderShape),
modifier = Modifier.placeholder(
visible = room.isPlaceholder,
shape = TextPlaceholderShape,
color = ElementTheme.colors.roomListPlaceHolder,
),
fontSize = 12.sp,
text = room.timestamp ?: "",
color = ElementTheme.colors.roomListRoomMessageDate,