From f421c18dc793c7ee1e0dadd554b75631249d4767 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 13 Sep 2023 16:35:15 +0200 Subject: [PATCH] add documentation and test tag --- .../ui/designsystem/component/BottomSheetShell.kt | 2 ++ .../ui/designsystem/component/BottomSheet.kt | 14 ++++++++++++++ .../mobile/ui/designsystem/component/Legend.kt | 2 ++ .../ui/designsystem/component/BottomSheetShell.kt | 1 + 4 files changed, 19 insertions(+) diff --git a/designsystem/src/androidMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheetShell.kt b/designsystem/src/androidMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheetShell.kt index b478d1efc..a5f2024fe 100644 --- a/designsystem/src/androidMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheetShell.kt +++ b/designsystem/src/androidMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheetShell.kt @@ -38,12 +38,14 @@ actual fun BottomSheetShell( searchBar: @Composable (() -> Unit)?, buttonBlock: @Composable (() -> Unit)?, content: @Composable (() -> Unit)?, + modifier: Modifier, onDismiss: () -> Unit, ) { val sheetState = rememberModalBottomSheetState(true) val scope = rememberCoroutineScope() ModalBottomSheet( + modifier = modifier, containerColor = Color.Transparent, onDismissRequest = { onDismiss() diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt index 9cb96e46b..5b17f23d4 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt @@ -57,6 +57,19 @@ fun BottomSheetHeader( } } +/** + * DHIS2 BottomSheetShell. Wraps compose ยท [ModalBottomSheet]. + * desktop version to be implemented + * @param title: title to be shown + * @param subtitle: subTitle to be shown + * @param description: PopUp description + * @param icon: the icon to be shown + * @param searchBar: dhis searchBar + * @param buttonBlock: Space for the lower buttons + * @param content: to be shown under the header + * @param onDismiss: gives access to the onDismiss event + * @param modifier allows a modifier to be passed externally + */ @Composable expect fun BottomSheetShell( title: String, @@ -66,5 +79,6 @@ expect fun BottomSheetShell( searchBar: @Composable (() -> Unit)? = null, buttonBlock: @Composable (() -> Unit)? = null, content: @Composable (() -> Unit)? = null, + modifier: Modifier = Modifier, onDismiss: () -> Unit, ) diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Legend.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Legend.kt index d18763777..dc3bd285c 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Legend.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Legend.kt @@ -29,6 +29,7 @@ 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.testTag import org.hisp.dhis.mobile.ui.designsystem.theme.Border import org.hisp.dhis.mobile.ui.designsystem.theme.InternalSizeValues import org.hisp.dhis.mobile.ui.designsystem.theme.Ripple @@ -93,6 +94,7 @@ fun Legend( if (showBottomSheetShell) { BottomSheetShell( + modifier = Modifier.testTag("LEGEND_BOTTOM_SHEET"), title = legendData.title, icon = { Icon( diff --git a/designsystem/src/desktopMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheetShell.kt b/designsystem/src/desktopMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheetShell.kt index 4b9cd9a0a..d7f0f92b9 100644 --- a/designsystem/src/desktopMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheetShell.kt +++ b/designsystem/src/desktopMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheetShell.kt @@ -16,6 +16,7 @@ actual fun BottomSheetShell( searchBar: @Composable (() -> Unit)?, buttonBlock: @Composable (() -> Unit)?, content: @Composable (() -> Unit)?, + modifier: Modifier, onDismiss: () -> Unit, ) { Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {