From 6f5b66cec84fcfff73206c8804d18b61af60eb30 Mon Sep 17 00:00:00 2001 From: Paul Kraft Date: Mon, 18 Nov 2024 15:29:29 -0800 Subject: [PATCH] review adaptions --- .../design/views/personalinfo/fields/NameFieldRow.kt | 7 +++---- .../design/views/personalinfo/fields/NameTextField.kt | 8 ++------ .../design/views/views/layout/DescriptionGridRow.kt | 10 +++------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/personalinfo/fields/NameFieldRow.kt b/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/personalinfo/fields/NameFieldRow.kt index 042376a79..69f62d4cf 100644 --- a/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/personalinfo/fields/NameFieldRow.kt +++ b/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/personalinfo/fields/NameFieldRow.kt @@ -46,10 +46,9 @@ fun NameFieldRow( content = { NameTextField( builder = builder, - component = component - ) { - label() - } + component = component, + label = label, + ) } ) } diff --git a/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/personalinfo/fields/NameTextField.kt b/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/personalinfo/fields/NameTextField.kt index 9f68568d9..9dce3c5e4 100644 --- a/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/personalinfo/fields/NameTextField.kt +++ b/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/personalinfo/fields/NameTextField.kt @@ -19,24 +19,22 @@ fun NameTextField( builder: PersonNameComponents.Builder, component: KMutableProperty1, modifier: Modifier = Modifier, - prompt: String? = null, ) { NameTextField( builder = builder, component = component, modifier = modifier, - prompt = prompt ) { Text(label) } } +// TODO: We got rid of "prompt" property here @Composable fun NameTextField( builder: PersonNameComponents.Builder, component: KMutableProperty1, modifier: Modifier = Modifier, - prompt: String? = null, label: @Composable () -> Unit, ) { val textState = remember(builder) { @@ -53,9 +51,7 @@ fun NameTextField( keyboardOptions = KeyboardOptions( autoCorrect = false, ), - // TODO: Check if placeholder is the right fit for the prompt property here. - placeholder = prompt?.let { { Text(it) } }, - label = label, + placeholder = label, modifier = modifier.fillMaxWidth() ) } diff --git a/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/views/layout/DescriptionGridRow.kt b/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/views/layout/DescriptionGridRow.kt index bc6657856..1b9d458b2 100644 --- a/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/views/layout/DescriptionGridRow.kt +++ b/core/design/src/main/kotlin/edu/stanford/spezi/core/design/views/views/layout/DescriptionGridRow.kt @@ -12,12 +12,10 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp +import edu.stanford.spezi.core.design.theme.Spacings import edu.stanford.spezi.core.design.theme.SpeziTheme import edu.stanford.spezi.core.design.theme.ThemePreviews -private const val DESCRIPTION_GRID_ROW_COMPONENT_WIDTH_FACTOR = 0.5f - @Composable fun DescriptionGridRow( description: @Composable BoxScope.() -> Unit, @@ -27,14 +25,13 @@ fun DescriptionGridRow( Row( modifier = modifier .fillMaxWidth() - .padding(vertical = 8.dp), - horizontalArrangement = Arrangement.spacedBy(8.dp), + .padding(vertical = Spacings.small), + horizontalArrangement = Arrangement.spacedBy(Spacings.medium), verticalAlignment = Alignment.CenterVertically ) { Box( modifier = Modifier .alignByBaseline() - .weight(DESCRIPTION_GRID_ROW_COMPONENT_WIDTH_FACTOR, fill = false) ) { description() } @@ -43,7 +40,6 @@ fun DescriptionGridRow( modifier = Modifier .alignByBaseline() .fillMaxWidth() - .weight(DESCRIPTION_GRID_ROW_COMPONENT_WIDTH_FACTOR) ) { content() }