Merge pull request #211 from vector-im/feature/fre/start_chat_search_matrixid
[Start chat] Show a single result when searching for a matrixId
This commit is contained in:
commit
02f2ace1e4
26 changed files with 246 additions and 64 deletions
|
|
@ -94,7 +94,7 @@ private fun InitialsAvatar(
|
|||
Text(
|
||||
modifier = Modifier.align(Alignment.Center),
|
||||
text = avatarData.getInitial(),
|
||||
fontSize = (avatarData.size.value / 2).sp,
|
||||
fontSize = (avatarData.size.dp / 2).value.sp,
|
||||
color = Color.White,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,13 +16,16 @@
|
|||
|
||||
package io.element.android.libraries.designsystem.components.avatar
|
||||
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
enum class AvatarSize(val value: Int) {
|
||||
SMALL(32),
|
||||
MEDIUM(40),
|
||||
BIG(48),
|
||||
HUGE(96);
|
||||
sealed class AvatarSize(open val dp: Dp) {
|
||||
|
||||
val dp = value.dp
|
||||
object SMALL : AvatarSize(32.dp)
|
||||
object MEDIUM : AvatarSize(40.dp)
|
||||
object BIG : AvatarSize(48.dp)
|
||||
object HUGE : AvatarSize(96.dp)
|
||||
|
||||
// FIXME maybe remove this field and switch back to an enum (or remove this class) when design system will be integrated
|
||||
data class Custom(override val dp: Dp) : AvatarSize(dp)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package io.element.android.libraries.designsystem.theme.components
|
|||
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.SearchBarColors
|
||||
import androidx.compose.material3.SearchBarDefaults
|
||||
|
|
@ -34,7 +35,7 @@ import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
|||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun DockedSearchBar(
|
||||
fun SearchBar(
|
||||
query: String,
|
||||
onQueryChange: (String) -> Unit,
|
||||
onSearch: (String) -> Unit,
|
||||
|
|
@ -45,13 +46,14 @@ fun DockedSearchBar(
|
|||
placeholder: @Composable (() -> Unit)? = null,
|
||||
leadingIcon: @Composable (() -> Unit)? = null,
|
||||
trailingIcon: @Composable (() -> Unit)? = null,
|
||||
shape: Shape = SearchBarDefaults.dockedShape,
|
||||
shape: Shape = SearchBarDefaults.inputFieldShape,
|
||||
colors: SearchBarColors = SearchBarDefaults.colors(),
|
||||
tonalElevation: Dp = SearchBarDefaults.Elevation,
|
||||
windowInsets: WindowInsets = SearchBarDefaults.windowInsets,
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
content: @Composable ColumnScope.() -> Unit,
|
||||
) {
|
||||
androidx.compose.material3.DockedSearchBar(
|
||||
androidx.compose.material3.SearchBar(
|
||||
query = query,
|
||||
onQueryChange = onQueryChange,
|
||||
onSearch = onSearch,
|
||||
|
|
@ -65,6 +67,7 @@ fun DockedSearchBar(
|
|||
shape = shape,
|
||||
colors = colors,
|
||||
tonalElevation = tonalElevation,
|
||||
windowInsets = windowInsets,
|
||||
interactionSource = interactionSource,
|
||||
content = content,
|
||||
)
|
||||
|
|
@ -80,7 +83,7 @@ internal fun DockedSearchBarDarkPreview() = ElementPreviewDark { ContentToPrevie
|
|||
|
||||
@Composable
|
||||
private fun ContentToPreview() {
|
||||
DockedSearchBar(
|
||||
SearchBar(
|
||||
query = "Some text",
|
||||
onQueryChange = {},
|
||||
onSearch = {},
|
||||
Loading…
Add table
Add a link
Reference in a new issue