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