Skip to content

Commit

Permalink
review adaptions
Browse files Browse the repository at this point in the history
  • Loading branch information
pauljohanneskraft committed Nov 18, 2024
1 parent 5c2d056 commit 6f5b66c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ fun NameFieldRow(
content = {
NameTextField(
builder = builder,
component = component
) {
label()
}
component = component,
label = label,
)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,22 @@ fun NameTextField(
builder: PersonNameComponents.Builder,
component: KMutableProperty1<PersonNameComponents.Builder, String?>,
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<PersonNameComponents.Builder, String?>,
modifier: Modifier = Modifier,
prompt: String? = null,
label: @Composable () -> Unit,
) {
val textState = remember(builder) {
Expand All @@ -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()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
}
Expand All @@ -43,7 +40,6 @@ fun DescriptionGridRow(
modifier = Modifier
.alignByBaseline()
.fillMaxWidth()
.weight(DESCRIPTION_GRID_ROW_COMPONENT_WIDTH_FACTOR)
) {
content()
}
Expand Down

0 comments on commit 6f5b66c

Please sign in to comment.