diff --git a/feature/bookmark/src/main/java/com/droidknights/app/feature/bookmark/component/EditModeLeadingItem.kt b/feature/bookmark/src/main/java/com/droidknights/app/feature/bookmark/component/EditModeLeadingItem.kt index 5f5268af..86c5bfb2 100644 --- a/feature/bookmark/src/main/java/com/droidknights/app/feature/bookmark/component/EditModeLeadingItem.kt +++ b/feature/bookmark/src/main/java/com/droidknights/app/feature/bookmark/component/EditModeLeadingItem.kt @@ -15,13 +15,18 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.droidknights.app.core.designsystem.theme.KnightsTheme import com.droidknights.app.core.designsystem.theme.Purple01 import com.droidknights.app.core.designsystem.theme.White +import com.droidknights.app.core.model.Room import com.droidknights.app.core.model.Session import com.droidknights.app.feature.bookmark.R import com.droidknights.app.feature.bookmark.model.BookmarkItemUiState import kotlinx.collections.immutable.ImmutableSet +import kotlinx.collections.immutable.persistentSetOf +import kotlinx.datetime.LocalDateTime @Composable internal fun EditModeLeadingItem( @@ -58,3 +63,45 @@ internal fun EditModeLeadingItem( ) } } + +private val SampleBookmarkItemUiState = BookmarkItemUiState( + index = 0, + session = Session( + id = "1", + title = "Session Title", + content = "Compose 성능 최적화를 위한 Stability 마스터하기", + speakers = emptyList(), + tags = emptyList(), + room = Room.TRACK1, + startTime = LocalDateTime(2022, 1, 1, 10, 0, 0), + endTime = LocalDateTime(2022, 1, 1, 11, 0, 0), + isBookmarked = true, + ), +) + +private val SampleSelectedSessionIds = persistentSetOf("1", "2", "3") +private val SampleUnselectedSessionIds = persistentSetOf("-1") + +@Preview +@Composable +private fun CheckedEditModeLeadingItemPreview() { + KnightsTheme { + EditModeLeadingItem( + itemState = SampleBookmarkItemUiState, + selectedSessionIds = SampleSelectedSessionIds, + onSelectedItem = {} + ) + } +} + +@Preview +@Composable +private fun UncheckedEditModeLeadingItemPreview() { + KnightsTheme { + EditModeLeadingItem( + itemState = SampleBookmarkItemUiState, + selectedSessionIds = SampleUnselectedSessionIds, + onSelectedItem = {} + ) + } +} diff --git a/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorCard.kt b/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorCard.kt index 40073661..6cd6b5fc 100644 --- a/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorCard.kt +++ b/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorCard.kt @@ -1,5 +1,6 @@ package com.droidknights.app.feature.contributor.component +import android.content.res.Configuration import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -14,6 +15,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.droidknights.app.core.designsystem.component.KnightsCard import com.droidknights.app.core.designsystem.component.NetworkImage @@ -27,7 +29,7 @@ import com.valentinilk.shimmer.shimmer @Composable internal fun ContributorCard( contributor: Contributor?, - modifier: Modifier, + modifier: Modifier = Modifier, ) { val uriHandler = LocalUriHandler.current val shimmerModifier = if (contributor == null) { @@ -88,3 +90,19 @@ internal fun ContributorCard( } } } + +@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO) +@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) +@Composable +private fun ContributorCardPreview() { + KnightsTheme { + ContributorCard( + contributor = Contributor( + id = 1L, + name = "Droid Knights", + imageUrl = "", + githubUrl = "" + ), + ) + } +} diff --git a/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorTopAppBar.kt b/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorTopAppBar.kt index 5c00ce96..8325be39 100644 --- a/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorTopAppBar.kt +++ b/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorTopAppBar.kt @@ -1,13 +1,20 @@ package com.droidknights.app.feature.contributor.component +import android.content.res.Configuration import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import com.droidknights.app.core.designsystem.component.KnightsTopAppBar import com.droidknights.app.core.designsystem.component.TopAppBarNavigationType +import com.droidknights.app.core.designsystem.theme.KnightsTheme import com.droidknights.app.feature.contributor.R @Composable @@ -29,3 +36,24 @@ internal fun ContributorTopAppBar( containerColor = containerColor, ) } + +@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO) +@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) +@Composable +private fun ContributorTopAppBarPreview() { + KnightsTheme { + Column { + ContributorTopAppBar( + isAtTop = false, + onBackClick = {}, + ) + + Spacer(modifier = Modifier.padding(top = 20.dp)) + + ContributorTopAppBar( + isAtTop = true, + onBackClick = {}, + ) + } + } +} diff --git a/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorTopBanner.kt b/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorTopBanner.kt index ec059e0a..d2db5059 100644 --- a/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorTopBanner.kt +++ b/feature/contributor/src/main/java/com/droidknights/app/feature/contributor/component/ContributorTopBanner.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBarsPadding @@ -14,6 +15,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.droidknights.app.core.designsystem.theme.Black import com.droidknights.app.core.designsystem.theme.KnightsTheme @@ -76,3 +78,17 @@ private fun ContributorBannerContent( ) } } + +@Preview +@Composable +private fun ContributorTopBannerPreview() { + KnightsTheme { + Column { + ContributorTopBanner(darkTheme = false) + + Spacer(modifier = Modifier.padding(top = 20.dp)) + + ContributorTopBanner(darkTheme = true) + } + } +} diff --git a/feature/session/src/main/java/com/droidknights/app/feature/session/component/SessionChip.kt b/feature/session/src/main/java/com/droidknights/app/feature/session/component/SessionChip.kt index 3bee6640..502be128 100644 --- a/feature/session/src/main/java/com/droidknights/app/feature/session/component/SessionChip.kt +++ b/feature/session/src/main/java/com/droidknights/app/feature/session/component/SessionChip.kt @@ -80,6 +80,12 @@ internal class RoomPreviewParameterProvider : PreviewParameterProvider { ) } +@Preview +@Composable +private fun TagChipPreview() { + TagChip(Tag("Android")) +} + @Preview @Composable fun TrackChipPreview( diff --git a/feature/session/src/main/java/com/droidknights/app/feature/session/component/SessionTopAppBar.kt b/feature/session/src/main/java/com/droidknights/app/feature/session/component/SessionTopAppBar.kt index 64f5ee84..05531d12 100644 --- a/feature/session/src/main/java/com/droidknights/app/feature/session/component/SessionTopAppBar.kt +++ b/feature/session/src/main/java/com/droidknights/app/feature/session/component/SessionTopAppBar.kt @@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.wrapContentSize +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme @@ -45,6 +46,7 @@ import com.droidknights.app.core.ui.RoomText import com.droidknights.app.feature.session.R import com.droidknights.app.feature.session.model.SessionState import kotlinx.collections.immutable.PersistentList +import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toPersistentList import kotlinx.coroutines.launch @@ -186,6 +188,21 @@ private fun Modifier.tabIndicatorOffset( .width(currentTabWidth) } +@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) +@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO) +@Composable +private fun SessionTopAppBarPreview() { + KnightsTheme { + SessionTopAppBar( + sessionState = SessionState( + sessions = persistentListOf(), + listState = rememberLazyListState() + ), + onBackClick = { } + ) + } +} + @Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) @Preview(uiMode = Configuration.UI_MODE_NIGHT_NO) @Composable