diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/MediumCard.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/MediumCard.kt index 64eeced..2b8de3c 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/MediumCard.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/MediumCard.kt @@ -31,20 +31,14 @@ import dev.datlag.aniflow.ui.theme.rememberSchemeThemeDominantColorState @Composable fun MediumCard( medium: Medium, - isHighlighted: Boolean, modifier: Modifier = Modifier, onClick: (Medium) -> Unit ) { - val scale by animateFloatAsState( - targetValue = if (isHighlighted) 1F else 0.95F, - animationSpec = tween() - ) - SchemeTheme( key = medium.id ) { Card( - modifier = modifier.scale(scale), + modifier = modifier, onClick = { onClick(medium) } diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/PopularSeasonOverview.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/PopularSeasonOverview.kt index a334133..3f04f58 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/PopularSeasonOverview.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/PopularSeasonOverview.kt @@ -79,29 +79,16 @@ private fun SuccessContent( StateSaver.List.Home.popularNextOverviewOffset }, ) - var highlightedItem by remember { mutableIntStateOf(0) } - - LaunchedEffect(listState) { - snapshotFlow { - val layoutInfo = listState.layoutInfo - layoutInfo.visibleItemsInfo - .firstOrNull { it.offset >= layoutInfo.viewportStartOffset } - ?.index ?: 0 - }.distinctUntilChanged().collect { - highlightedItem = it - } - } LazyRow( state = listState, modifier = Modifier.fillMaxSize(), - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(16.dp), contentPadding = PaddingValues(horizontal = 16.dp) ) { - itemsIndexed(data, key = { _, it -> it.id }) {index, medium -> + itemsIndexed(data, key = { _, it -> it.id }) { _, medium -> MediumCard( medium = Medium(medium), - isHighlighted = index == highlightedItem, modifier = Modifier.width(200.dp).height(280.dp), onClick = onClick ) diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/TrendingOverview.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/TrendingOverview.kt index a99e3a7..a6a18e2 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/TrendingOverview.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/initial/home/component/TrendingOverview.kt @@ -66,29 +66,16 @@ private fun SuccessContent( initialFirstVisibleItemIndex = StateSaver.List.Home.trendingOverview, initialFirstVisibleItemScrollOffset = StateSaver.List.Home.trendingOverviewOffset ) - var highlightedItem by remember { mutableIntStateOf(0) } - - LaunchedEffect(listState) { - snapshotFlow { - val layoutInfo = listState.layoutInfo - layoutInfo.visibleItemsInfo - .firstOrNull { it.offset >= layoutInfo.viewportStartOffset } - ?.index ?: 0 - }.distinctUntilChanged().collect { - highlightedItem = it - } - } LazyRow( state = listState, modifier = Modifier.fillMaxSize(), - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(16.dp), contentPadding = PaddingValues(horizontal = 16.dp) ) { - itemsIndexed(data, key = { _, it -> it.id }) {index, medium -> + itemsIndexed(data, key = { _, it -> it.id }) { _, medium -> MediumCard( medium = Medium(medium), - isHighlighted = index == highlightedItem, modifier = Modifier.width(200.dp).height(280.dp), onClick = onClick )