diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt index 9ac8b9f73..ef3d095b1 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt @@ -22,6 +22,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import org.hisp.dhis.common.screens.BottomSheetHeaderScreen +import org.hisp.dhis.common.screens.BottomSheetScreen import org.hisp.dhis.common.screens.ButtonBlockScreen import org.hisp.dhis.common.screens.ButtonScreen import org.hisp.dhis.common.screens.CheckboxScreen @@ -122,6 +123,7 @@ fun Main() { Components.BUTTON_BLOCK -> ButtonBlockScreen() Components.ICON_CARDS -> IconCardsScreen() Components.BOTTOM_SHEET_HEADER -> BottomSheetHeaderScreen() + Components.BOTTOM_SHEET -> BottomSheetScreen() Components.TAGS -> TagsScreen() Components.SECTIONS -> SectionScreen() Components.INPUT_POSITIVE_INTEGER_OR_ZERO -> InputPositiveIntegerOrZeroScreen() diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/BottomSheetHeaderScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/BottomSheetHeaderScreen.kt index 156482dab..a87f57a85 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/BottomSheetHeaderScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/BottomSheetHeaderScreen.kt @@ -5,19 +5,13 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.outlined.BookmarkBorder import androidx.compose.material.icons.outlined.HelpOutline import androidx.compose.material3.Icon import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import org.hisp.dhis.mobile.ui.designsystem.component.BottomSheetHeader -import org.hisp.dhis.mobile.ui.designsystem.component.BottomSheetShell -import org.hisp.dhis.mobile.ui.designsystem.component.Button -import org.hisp.dhis.mobile.ui.designsystem.component.ButtonStyle import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer -import org.hisp.dhis.mobile.ui.designsystem.component.LegendDescriptionData -import org.hisp.dhis.mobile.ui.designsystem.component.LegendRange import org.hisp.dhis.mobile.ui.designsystem.component.SubTitle import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor @@ -88,48 +82,5 @@ fun BottomSheetHeaderScreen() { ) } SubTitle("Bottom sheet shell with header, content and buttons", TextColor.OnSurface) - - Box(modifier = Modifier.border(Spacing.Spacing1, color = TextColor.OnDisabledSurface)) { - BottomSheetShell( - "Legend name", - "subtitle", - "Lorem fistrum a wan benemeritaar llevame al sircoo. ", - content = { - LegendRange( - listOf( - LegendDescriptionData( - SurfaceColor.CustomGreen, - "Low", - IntRange(0, 5), - ), - LegendDescriptionData(SurfaceColor.CustomYellow, "Medium", IntRange(5, 10)), - LegendDescriptionData(TextColor.OnWarning, "High", IntRange(10, 20)), - LegendDescriptionData(SurfaceColor.CustomPink, "Very high", IntRange(20, 40)), - LegendDescriptionData(SurfaceColor.CustomBrown, "Extreme", IntRange(40, 120)), - LegendDescriptionData( - SurfaceColor.CustomGray, - "Lorem fistrum a wan benemeritaar llevame al sircoo. " + - "Torpedo está la cosa muy malar diodeno se calle ustée ahorarr al ataquerl condemor a wan.", - IntRange(120, 1000), - ), - ), - ) - }, - buttonBlock = { - Button( - enabled = true, - style = ButtonStyle.OUTLINED, - text = "Label", - icon = { - Icon( - imageVector = Icons.Filled.Add, - contentDescription = "Button", - tint = SurfaceColor.Primary, - ) - }, - ) {} - } - ) - } } } diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/BottomSheetScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/BottomSheetScreen.kt index 5f726e5af..96dc7927b 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/BottomSheetScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/BottomSheetScreen.kt @@ -1,7 +1,9 @@ package org.hisp.dhis.common.screens import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.outlined.Info @@ -12,24 +14,75 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import org.hisp.dhis.common.screens.previews.longLegendList import org.hisp.dhis.common.screens.previews.lorem +import org.hisp.dhis.common.screens.previews.regularLegendList import org.hisp.dhis.mobile.ui.designsystem.component.BottomSheetShell import org.hisp.dhis.mobile.ui.designsystem.component.Button import org.hisp.dhis.mobile.ui.designsystem.component.ButtonBlock import org.hisp.dhis.mobile.ui.designsystem.component.ButtonStyle import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer -import org.hisp.dhis.mobile.ui.designsystem.component.LegendDescriptionData import org.hisp.dhis.mobile.ui.designsystem.component.LegendRange +import org.hisp.dhis.mobile.ui.designsystem.component.SubTitle +import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor -import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor @Composable fun BottomSheetScreen() { - var showBottomSheetShell by rememberSaveable { mutableStateOf(false) } + var showBottomSheetShellScrollableContent by rememberSaveable { mutableStateOf(false) } - if (showBottomSheetShell) { + var showLegendBottomSheetShell by rememberSaveable { mutableStateOf(false) } + var showBottomSheetShellMaxExpansion by rememberSaveable { mutableStateOf(false) } + var showBottomSheetShellSingleButton by rememberSaveable { mutableStateOf(false) } + var showBottomSheetShellTwoButtons by rememberSaveable { mutableStateOf(false) } + + if (showLegendBottomSheetShell) { + BottomSheetShell( + title = "Legend name ", + icon = { + Icon( + imageVector = Icons.Outlined.Info, + contentDescription = "Button", + tint = SurfaceColor.Primary, + ) + }, + content = { + Column() { + LegendRange( + regularLegendList, + ) + } + }, + ) { + showLegendBottomSheetShell = false + } + } + if (showBottomSheetShellScrollableContent) { + BottomSheetShell( + title = "Legend name ", + icon = { + Icon( + imageVector = Icons.Outlined.Info, + contentDescription = "Button", + tint = SurfaceColor.Primary, + ) + }, + content = { + Column() { + LegendRange( + longLegendList, + ) + } + }, + ) { + showBottomSheetShellScrollableContent = false + } + } + if (showBottomSheetShellMaxExpansion) { BottomSheetShell( title = "Legend name ", + subtitle = "Subtitle", + description = lorem + lorem, buttonBlock = { ButtonBlock( primaryButton = { @@ -44,7 +97,7 @@ fun BottomSheetScreen() { enabled = true, text = "Label", onClick = { - showBottomSheetShell = false + showBottomSheetShellMaxExpansion = false }, modifier = Modifier.fillMaxWidth(), ) @@ -61,143 +114,169 @@ fun BottomSheetScreen() { content = { Column() { LegendRange( - listOf( - LegendDescriptionData( - SurfaceColor.CustomGreen, - "Low", - IntRange(0, 5), - ), - LegendDescriptionData( - SurfaceColor.CustomYellow, - "Medium", - IntRange(5, 10), - ), - LegendDescriptionData( - TextColor.OnWarning, - "High", - IntRange(10, 20), - ), - LegendDescriptionData( - SurfaceColor.CustomPink, - "Very high", - IntRange(20, 40), - ), - LegendDescriptionData( - SurfaceColor.CustomBrown, - "Extreme", - IntRange(40, 120), - ), - LegendDescriptionData( - SurfaceColor.CustomGray, - text = lorem, - IntRange(120, 1000), - ), - LegendDescriptionData( - SurfaceColor.CustomGreen, - "Low", - IntRange(0, 5), - ), - LegendDescriptionData( - SurfaceColor.CustomYellow, - "Medium", - IntRange(5, 10), - ), - LegendDescriptionData( - TextColor.OnWarning, - "High", - IntRange(10, 20), - ), - LegendDescriptionData( - SurfaceColor.CustomPink, - "Very high", - IntRange(20, 40), - ), - LegendDescriptionData( - SurfaceColor.CustomBrown, - "Extreme", - IntRange(40, 120), - ), - LegendDescriptionData( - SurfaceColor.CustomGray, - text = lorem, - IntRange(120, 1000), - ), - LegendDescriptionData( - SurfaceColor.CustomGreen, - "Low", - IntRange(0, 5), - ), - LegendDescriptionData( - SurfaceColor.CustomYellow, - "Medium", - IntRange(5, 10), - ), - LegendDescriptionData( - TextColor.OnWarning, - "High", - IntRange(10, 20), - ), - LegendDescriptionData( - SurfaceColor.CustomPink, - "Very high", - IntRange(20, 40), - ), - LegendDescriptionData( - SurfaceColor.CustomBrown, - "Extreme", - IntRange(40, 120), - ), - LegendDescriptionData( - SurfaceColor.CustomGray, - text = lorem, - IntRange(120, 1000), - ), - LegendDescriptionData( - SurfaceColor.CustomGreen, - "Low", - IntRange(0, 5), - ), - LegendDescriptionData( - SurfaceColor.CustomYellow, - "Medium", - IntRange(5, 10), - ), - LegendDescriptionData( - TextColor.OnWarning, - "High", - IntRange(10, 20), - ), - LegendDescriptionData( - SurfaceColor.CustomPink, - "Very high", - IntRange(20, 40), - ), - LegendDescriptionData( - SurfaceColor.CustomBrown, - "Extreme", - IntRange(40, 120), - ), - LegendDescriptionData( - SurfaceColor.CustomGray, - text = lorem, - IntRange(120, 1000), - ), - ), + longLegendList, ) } }, ) { - showBottomSheetShell = false + showBottomSheetShellMaxExpansion = false } - } else {} + } + + if (showBottomSheetShellSingleButton) { + BottomSheetShell( + title = "Legend name ", + subtitle = "Subtitle", + description = lorem, + buttonBlock = { + ButtonBlock( + primaryButton = { + Button( + style = ButtonStyle.FILLED, + icon = { + Icon( + imageVector = Icons.Filled.Add, + contentDescription = "Button", + ) + }, + enabled = true, + text = "Label", + onClick = { + showBottomSheetShellSingleButton = false + }, + modifier = Modifier.fillMaxWidth(), + ) + }, + ) + }, + icon = { + Icon( + imageVector = Icons.Outlined.Info, + contentDescription = "Button", + tint = SurfaceColor.Primary, + ) + }, + content = { + Column() { + LegendRange( + regularLegendList, + ) + } + }, + ) { + showBottomSheetShellSingleButton = false + } + } + + if (showBottomSheetShellTwoButtons) { + BottomSheetShell( + title = "Legend name ", + subtitle = "Subtitle", + description = lorem, + buttonBlock = { + ButtonBlock( + primaryButton = { + Button( + style = ButtonStyle.OUTLINED, + icon = { + Icon( + imageVector = Icons.Filled.Add, + contentDescription = "Button", + ) + }, + enabled = true, + text = "Label", + onClick = { + showBottomSheetShellTwoButtons = false + }, + modifier = Modifier.fillMaxWidth(), + ) + }, + secondaryButton = { + Button( + style = ButtonStyle.FILLED, + icon = { + Icon( + imageVector = Icons.Filled.Add, + contentDescription = "Button", + ) + }, + enabled = true, + text = "Label", + onClick = { + }, + modifier = Modifier.fillMaxWidth(), + ) + }, + ) + }, + icon = { + Icon( + imageVector = Icons.Outlined.Info, + contentDescription = "Button", + tint = SurfaceColor.Primary, + ) + }, + content = { + Column() { + LegendRange( + regularLegendList, + ) + } + }, + ) { + showBottomSheetShellTwoButtons = false + } + } ColumnComponentContainer { + SubTitle("Legend type bottom sheet shell") + Button( + enabled = true, + ButtonStyle.FILLED, + text = "Show Modal", + ) { + showLegendBottomSheetShell = !showLegendBottomSheetShell + } + Spacer(modifier = Modifier.size(Spacing.Spacing10)) + + SubTitle("Bottom sheet shell with scrollable content") + Button( + enabled = true, + ButtonStyle.FILLED, + text = "Show Modal", + ) { + showBottomSheetShellScrollableContent = !showBottomSheetShellScrollableContent + } + Spacer(modifier = Modifier.size(Spacing.Spacing10)) + + SubTitle("Bottom sheet shell with with maximum expansion ") + Button( + enabled = true, + ButtonStyle.FILLED, + text = "Show Modal", + ) { + showBottomSheetShellMaxExpansion = !showBottomSheetShellScrollableContent + } + Spacer(modifier = Modifier.size(Spacing.Spacing10)) + SubTitle("Bottom sheet shell with single button") + Button( + enabled = true, + ButtonStyle.FILLED, + text = "Show Modal", + ) { + showBottomSheetShellSingleButton = !showBottomSheetShellSingleButton + } + Spacer(modifier = Modifier.size(Spacing.Spacing10)) + + SubTitle("Bottom sheet shell with two buttons") Button( enabled = true, ButtonStyle.FILLED, text = "Show Modal", ) { - showBottomSheetShell = !showBottomSheetShell + showBottomSheetShellTwoButtons = !showBottomSheetShellTwoButtons } + Spacer(modifier = Modifier.size(Spacing.Spacing10)) } } diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt index 83ce3ac26..0484de12e 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt @@ -14,6 +14,7 @@ enum class Components(val label: String) { INPUT_NUMBER("Input Number"), INPUT_LETTER("Input Letter"), BOTTOM_SHEET_HEADER("Bottom Sheet Header"), + BOTTOM_SHEET("Bottom Sheet "), TAGS("Tags"), SECTIONS("Sections"), RADIO("Radio"), diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/FormShellsScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/FormShellsScreen.kt index 451aec45f..17fcd8f41 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/FormShellsScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/FormShellsScreen.kt @@ -10,12 +10,12 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.ImeAction import org.hisp.dhis.common.screens.previews.lorem +import org.hisp.dhis.common.screens.previews.regularLegendList import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer import org.hisp.dhis.mobile.ui.designsystem.component.Description import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState import org.hisp.dhis.mobile.ui.designsystem.component.InputText import org.hisp.dhis.mobile.ui.designsystem.component.LegendData -import org.hisp.dhis.mobile.ui.designsystem.component.LegendDescriptionData import org.hisp.dhis.mobile.ui.designsystem.component.SubTitle import org.hisp.dhis.mobile.ui.designsystem.component.SupportingTextData import org.hisp.dhis.mobile.ui.designsystem.component.SupportingTextState @@ -28,68 +28,6 @@ fun FormShellsScreen() { ColumnComponentContainer(title = "Form Shells") { SubTitle("Outer frames for form elements", TextColor.OnSurface) Description("Focused/Unfocused", TextColor.OnSurface) - val legendDescriptionData = listOf( - LegendDescriptionData( - SurfaceColor.CustomGreen, - "Low", - IntRange(0, 5), - ), - LegendDescriptionData( - SurfaceColor.CustomYellow, - "Medium", - IntRange(5, 10), - ), - LegendDescriptionData( - TextColor.OnWarning, - "High", - IntRange(10, 20), - ), - LegendDescriptionData( - SurfaceColor.CustomPink, - "Very high", - IntRange(20, 40), - ), - LegendDescriptionData( - SurfaceColor.CustomBrown, - "Extreme", - IntRange(40, 120), - ), - LegendDescriptionData( - SurfaceColor.CustomGray, - text = lorem, - IntRange(120, 1000), - ), - LegendDescriptionData( - SurfaceColor.CustomGreen, - "Low", - IntRange(0, 5), - ), - LegendDescriptionData( - SurfaceColor.CustomYellow, - "Medium", - IntRange(5, 10), - ), - LegendDescriptionData( - TextColor.OnWarning, - "High", - IntRange(10, 20), - ), - LegendDescriptionData( - SurfaceColor.CustomPink, - "Very high", - IntRange(20, 40), - ), - LegendDescriptionData( - SurfaceColor.CustomBrown, - "Extreme", - IntRange(40, 120), - ), - LegendDescriptionData( - SurfaceColor.CustomGray, - text = lorem, - IntRange(120, 1000), - ), - ) var inputValue1 by rememberSaveable { mutableStateOf("Input") } InputText( @@ -319,7 +257,7 @@ fun FormShellsScreen() { InputText( "Label", inputText = inputValue14, - legendData = LegendData(SurfaceColor.CustomGreen, "Legend", popUpLegendDescriptionData = legendDescriptionData), + legendData = LegendData(SurfaceColor.CustomGreen, "Legend", popUpLegendDescriptionData = regularLegendList), onValueChanged = { if (it != null) { inputValue14 = it @@ -331,7 +269,7 @@ fun FormShellsScreen() { InputText( "Label", inputText = inputValue15, - legendData = LegendData(SurfaceColor.CustomYellow, "Legend", popUpLegendDescriptionData = legendDescriptionData), + legendData = LegendData(SurfaceColor.CustomYellow, "Legend", popUpLegendDescriptionData = regularLegendList), onValueChanged = { if (it != null) { inputValue15 = it @@ -345,7 +283,7 @@ fun FormShellsScreen() { InputText( "Label", inputText = inputValue16, - legendData = LegendData(SurfaceColor.CustomYellow, "Legend", popUpLegendDescriptionData = legendDescriptionData), + legendData = LegendData(SurfaceColor.CustomYellow, "Legend", popUpLegendDescriptionData = regularLegendList), supportingText = listOf( SupportingTextData( "Supporting Text", diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/previews/LegendSampleList.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/previews/LegendSampleList.kt new file mode 100644 index 000000000..4cf3bd154 --- /dev/null +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/previews/LegendSampleList.kt @@ -0,0 +1,161 @@ +package org.hisp.dhis.common.screens.previews + +import org.hisp.dhis.mobile.ui.designsystem.component.LegendDescriptionData +import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor +import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor + +val regularLegendList = listOf( + LegendDescriptionData( + SurfaceColor.CustomGreen, + "Low", + IntRange(0, 5), + ), + LegendDescriptionData( + SurfaceColor.CustomYellow, + "Medium", + IntRange(5, 10), + ), + LegendDescriptionData( + TextColor.OnWarning, + "High", + IntRange(10, 20), + ), + LegendDescriptionData( + SurfaceColor.CustomPink, + "Very high", + IntRange(20, 40), + ), + LegendDescriptionData( + SurfaceColor.CustomBrown, + "Extreme", + IntRange(40, 120), + ), + LegendDescriptionData( + SurfaceColor.CustomGray, + text = lorem, + IntRange(120, 1000), + ), +) + +val longLegendList = listOf( + LegendDescriptionData( + SurfaceColor.CustomGreen, + "Low", + IntRange(0, 5), + ), + LegendDescriptionData( + SurfaceColor.CustomYellow, + "Medium", + IntRange(5, 10), + ), + LegendDescriptionData( + TextColor.OnWarning, + "High", + IntRange(10, 20), + ), + LegendDescriptionData( + SurfaceColor.CustomPink, + "Very high", + IntRange(20, 40), + ), + LegendDescriptionData( + SurfaceColor.CustomBrown, + "Extreme", + IntRange(40, 120), + ), + LegendDescriptionData( + SurfaceColor.CustomGray, + text = lorem, + IntRange(120, 1000), + ), + LegendDescriptionData( + SurfaceColor.CustomGreen, + "Low", + IntRange(0, 5), + ), + LegendDescriptionData( + SurfaceColor.CustomYellow, + "Medium", + IntRange(5, 10), + ), + LegendDescriptionData( + TextColor.OnWarning, + "High", + IntRange(10, 20), + ), + LegendDescriptionData( + SurfaceColor.CustomPink, + "Very high", + IntRange(20, 40), + ), + LegendDescriptionData( + SurfaceColor.CustomBrown, + "Extreme", + IntRange(40, 120), + ), + LegendDescriptionData( + SurfaceColor.CustomGray, + text = lorem, + IntRange(120, 1000), + ), + LegendDescriptionData( + SurfaceColor.CustomGreen, + "Low", + IntRange(0, 5), + ), + LegendDescriptionData( + SurfaceColor.CustomYellow, + "Medium", + IntRange(5, 10), + ), + LegendDescriptionData( + TextColor.OnWarning, + "High", + IntRange(10, 20), + ), + LegendDescriptionData( + SurfaceColor.CustomPink, + "Very high", + IntRange(20, 40), + ), + LegendDescriptionData( + SurfaceColor.CustomBrown, + "Extreme", + IntRange(40, 120), + ), + LegendDescriptionData( + SurfaceColor.CustomGray, + text = lorem, + IntRange(120, 1000), + ), + LegendDescriptionData( + SurfaceColor.CustomGreen, + "Low", + IntRange(0, 5), + ), + LegendDescriptionData( + SurfaceColor.CustomYellow, + "Medium", + IntRange(5, 10), + ), + LegendDescriptionData( + TextColor.OnWarning, + "High", + IntRange(10, 20), + ), + LegendDescriptionData( + SurfaceColor.CustomPink, + "Very high", + IntRange(20, 40), + ), + LegendDescriptionData( + SurfaceColor.CustomBrown, + "Extreme", + IntRange(40, 120), + ), + LegendDescriptionData( + SurfaceColor.CustomGray, + text = lorem, + IntRange(120, 1000), + ), +) 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 5d0d67f08..b478d1efc 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 @@ -21,7 +21,6 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp import kotlinx.coroutines.launch import org.hisp.dhis.mobile.ui.designsystem.theme.InternalSizeValues import org.hisp.dhis.mobile.ui.designsystem.theme.Shape @@ -76,7 +75,7 @@ actual fun BottomSheetShell( modifier = Modifier .background(SurfaceColor.SurfaceBright, Shape.ExtraLargeTop) .padding(Spacing.Spacing24) - .heightIn(Spacing.Spacing0, 800.dp) + .heightIn(Spacing.Spacing0, InternalSizeValues.Size800) .verticalScroll(rememberScrollState()), horizontalAlignment = Alignment.CenterHorizontally, ) { @@ -91,20 +90,23 @@ actual fun BottomSheetShell( searchBar?.invoke() HorizontalDivider( modifier = Modifier.fillMaxWidth() - .padding(top = Spacing.Spacing8, bottom = Spacing.Spacing8), + .padding(top = Spacing.Spacing24), color = TextColor.OnDisabledSurface, ) - Box(modifier = Modifier.align(Alignment.Start).heightIn(Spacing.Spacing0, InternalSizeValues.Size386)) { + Box( + modifier = Modifier.align(Alignment.Start) + .heightIn(Spacing.Spacing0, InternalSizeValues.Size386) + .padding(bottom = Spacing.Spacing24), + ) { Column( modifier = Modifier .verticalScroll(rememberScrollState()) - .padding(bottom = Spacing.Spacing24) .fillMaxHeight(1f), ) { content?.let { it.invoke() HorizontalDivider( - modifier = Modifier.fillMaxWidth().padding(Spacing.Spacing8), + modifier = Modifier.fillMaxWidth().padding(top = Spacing.Spacing8), color = TextColor.OnDisabledSurface, ) } 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 259fb7763..9cb96e46b 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 @@ -1,9 +1,5 @@ package org.hisp.dhis.mobile.ui.designsystem.component -import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.AnimatedVisibilityScope -import androidx.compose.animation.expandVertically -import androidx.compose.animation.shrinkVertically import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding @@ -72,20 +68,3 @@ expect fun BottomSheetShell( content: @Composable (() -> Unit)? = null, onDismiss: () -> Unit, ) - -@Composable -internal fun AnimatedExpandTransition( - visible: Boolean, - content: @Composable AnimatedVisibilityScope.() -> Unit, -) { - AnimatedVisibility( - visible = visible, - enter = expandVertically( - expandFrom = Alignment.Bottom, - ), - exit = shrinkVertically( - shrinkTowards = Alignment.Bottom, - ), - content = content, - ) -} 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 6b2067c2a..d18763777 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 @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.outlined.HelpOutline import androidx.compose.material.icons.outlined.Info import androidx.compose.material.ripple.LocalRippleTheme @@ -95,27 +94,6 @@ fun Legend( if (showBottomSheetShell) { BottomSheetShell( title = legendData.title, - buttonBlock = { - ButtonBlock( - primaryButton = { - Button( - style = ButtonStyle.FILLED, - icon = { - Icon( - imageVector = Icons.Filled.Add, - contentDescription = "Button", - ) - }, - enabled = true, - text = "Label", - onClick = { - showBottomSheetShell = false - }, - modifier = Modifier.fillMaxWidth(), - ) - }, - ) - }, icon = { Icon( imageVector = Icons.Outlined.Info, diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Spacing.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Spacing.kt index 89d0307ad..c79c31c55 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Spacing.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Spacing.kt @@ -40,6 +40,7 @@ internal object InternalSizeValues { val Size300: Dp = 300.dp val Size386: Dp = 386.dp val Size578: Dp = 578.dp + val Size800: Dp = 800.dp } internal object InternalFloatValues {