-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ANDROAPP-5889-mobile-ui-indicator-component (#182)
* Add indicator input * Fix corner radius not applying to start of indicator input
- Loading branch information
1 parent
8865bdf
commit 6f7cd7b
Showing
4 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
common/src/commonMain/kotlin/org/hisp/dhis/common/screens/IndicatorInputScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.hisp.dhis.common.screens | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.Color | ||
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer | ||
import org.hisp.dhis.mobile.ui.designsystem.component.IndicatorInput | ||
|
||
@Composable | ||
fun IndicatorInputScreen() { | ||
ColumnComponentContainer { | ||
IndicatorInput( | ||
title = "Systolic and diastolic pressure", | ||
content = "120 mmHg / 80 mmHg", | ||
indicatorColor = Color(0xFF00A940), | ||
) | ||
IndicatorInput( | ||
title = "Heart rate", | ||
content = "160 bpm", | ||
indicatorColor = Color(0xFFE12F58), | ||
) | ||
IndicatorInput( | ||
title = "Cholesterol", | ||
content = "190 mg/dL", | ||
indicatorColor = Color(0xFFFADB14), | ||
) | ||
IndicatorInput( | ||
title = "Blood Oxygen Level", | ||
content = "96%", | ||
indicatorColor = Color(0xFFFFF7C7), | ||
) | ||
IndicatorInput( | ||
title = "Cholesterol", | ||
content = "190 mg/dL", | ||
) | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...em/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/IndicatorInput.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.hisp.dhis.mobile.ui.designsystem.component | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.IntrinsicSize | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxHeight | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.requiredWidth | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.Color | ||
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing | ||
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor | ||
|
||
@Composable | ||
fun IndicatorInput( | ||
title: String, | ||
content: String, | ||
modifier: Modifier = Modifier, | ||
indicatorColor: Color = SurfaceColor.Container, | ||
) { | ||
val backgroundColor = indicatorColor.copy(alpha = 0.1f) | ||
|
||
Row( | ||
modifier = modifier.fillMaxWidth() | ||
.height(IntrinsicSize.Max) | ||
.clip(RoundedCornerShape(Spacing.Spacing8)) | ||
.background(backgroundColor), | ||
) { | ||
Box( | ||
Modifier.padding( | ||
horizontal = Spacing.Spacing16, | ||
vertical = Spacing.Spacing8, | ||
).weight(1f), | ||
) { | ||
Column { | ||
Text( | ||
text = title, | ||
style = MaterialTheme.typography.bodyMedium, | ||
modifier = Modifier.fillMaxWidth(), | ||
) | ||
Text( | ||
text = content, | ||
style = MaterialTheme.typography.bodyLarge, | ||
modifier = Modifier.fillMaxWidth(), | ||
) | ||
} | ||
} | ||
|
||
Box(Modifier.background(indicatorColor).requiredWidth(Spacing.Spacing16).fillMaxHeight()) | ||
} | ||
} |