Extract room name and topic to dedicated composable
This commit is contained in:
parent
9c1c9f33d1
commit
2b912ebe47
1 changed files with 41 additions and 31 deletions
|
|
@ -167,22 +167,12 @@ fun RoomNameWithAvatar(
|
|||
onClick = onAvatarClick,
|
||||
)
|
||||
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
text = "Room name"
|
||||
)
|
||||
|
||||
TextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = roomName,
|
||||
placeholder = { Text("e.g. Product Sprint") },
|
||||
onValueChange = onRoomNameChanged,
|
||||
maxLines = 1,
|
||||
)
|
||||
}
|
||||
LabelledTextField(
|
||||
label = "Room name",
|
||||
value = roomName,
|
||||
placeholder = "e.g. Product Sprint",
|
||||
onValueChange = onRoomNameChanged
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -227,22 +217,14 @@ fun RoomTopic(
|
|||
modifier: Modifier = Modifier,
|
||||
onTopicChanged: (String) -> Unit = {},
|
||||
) {
|
||||
Column(
|
||||
LabelledTextField(
|
||||
modifier = modifier,
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
text = "Topic (optional)",
|
||||
)
|
||||
TextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = topic,
|
||||
placeholder = { Text("What is this room about?") },
|
||||
onValueChange = onTopicChanged,
|
||||
maxLines = 3,
|
||||
)
|
||||
}
|
||||
label = "Topic (optional)",
|
||||
value = topic,
|
||||
placeholder = "What is this room about?",
|
||||
onValueChange = onTopicChanged,
|
||||
maxLines = 3,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
@ -345,6 +327,34 @@ fun RoomPrivacyOption(
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun LabelledTextField(
|
||||
label: String,
|
||||
value: String,
|
||||
modifier: Modifier = Modifier,
|
||||
placeholder: String = "",
|
||||
maxLines: Int = 1,
|
||||
onValueChange: (String) -> Unit,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
text = label
|
||||
)
|
||||
|
||||
TextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = value,
|
||||
placeholder = { Text(placeholder) },
|
||||
onValueChange = onValueChange,
|
||||
maxLines = maxLines,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun ConfigureRoomViewLightPreview(@PreviewParameter(ConfigureRoomStateProvider::class) state: ConfigureRoomState) =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue