diff --git a/backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/appsearchmodal/BpkAppSearchModal.kt b/backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/appsearchmodal/BpkAppSearchModal.kt index 955e0a9154..fe812f5241 100644 --- a/backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/appsearchmodal/BpkAppSearchModal.kt +++ b/backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/appsearchmodal/BpkAppSearchModal.kt @@ -19,11 +19,14 @@ package net.skyscanner.backpack.compose.appsearchmodal import androidx.compose.runtime.Composable +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.text.AnnotatedString +import kotlinx.coroutines.launch import net.skyscanner.backpack.compose.appsearchmodal.internal.BpkAppSearchModalImpl import net.skyscanner.backpack.compose.icon.BpkIcon import net.skyscanner.backpack.compose.modal.BpkModal +import net.skyscanner.backpack.compose.modal.BpkModalState import net.skyscanner.backpack.compose.modal.rememberBpkModalState import net.skyscanner.backpack.compose.navigationbar.NavIcon @@ -71,15 +74,18 @@ fun BpkAppSearchModal( onInputChanged: (String) -> Unit, onClose: () -> Unit, modifier: Modifier = Modifier, + state: BpkModalState = rememberBpkModalState(), ) { - + val coroutineScope = rememberCoroutineScope() BpkModal( navIcon = NavIcon.Close( contentDescription = closeAccessibilityLabel, - onClick = onClose, + onClick = { + coroutineScope.launch { state.hide() } + }, ), modifier = modifier, - state = rememberBpkModalState(), + state = state, action = null, title = title, onDismiss = onClose, diff --git a/backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/appsearchmodal/internal/BpkSearchModalLoading.kt b/backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/appsearchmodal/internal/BpkSearchModalLoading.kt index c824d194a2..933032ec09 100644 --- a/backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/appsearchmodal/internal/BpkSearchModalLoading.kt +++ b/backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/appsearchmodal/internal/BpkSearchModalLoading.kt @@ -27,21 +27,28 @@ import androidx.compose.ui.semantics.semantics import androidx.compose.ui.unit.dp import net.skyscanner.backpack.compose.appsearchmodal.BpkAppSearchModalResult import net.skyscanner.backpack.compose.sleketon.BpkBodyTextSkeleton +import net.skyscanner.backpack.compose.sleketon.BpkShimmerOverlay import net.skyscanner.backpack.compose.tokens.BpkSpacing private const val SkeletonCount = 10 private const val SkeletonItemWidth = 200 + @Composable -internal fun BpkSearchModalLoading(results: BpkAppSearchModalResult.Loading) { - Column(modifier = Modifier.semantics(mergeDescendants = true) { - contentDescription = results.accessibilityLabel - }) { - for (i in 0..SkeletonCount) { - BpkBodyTextSkeleton( - modifier = Modifier - .padding(BpkSpacing.Base) - .width(SkeletonItemWidth.dp), - ) +internal fun BpkSearchModalLoading( + results: BpkAppSearchModalResult.Loading, + modifier: Modifier = Modifier, +) { + BpkShimmerOverlay(modifier = modifier) { + Column(modifier = Modifier.semantics(mergeDescendants = true) { + contentDescription = results.accessibilityLabel + }) { + for (i in 0..SkeletonCount) { + BpkBodyTextSkeleton( + modifier = Modifier + .padding(BpkSpacing.Base) + .width(SkeletonItemWidth.dp), + ) + } } } }