Merge pull request #202 from vector-im/fix/mna/trailing-icon-search-bar
Fix display of trailing icon in the search bar
This commit is contained in:
commit
7f0f0d1408
2 changed files with 17 additions and 10 deletions
1
changelog.d/202.wip
Normal file
1
changelog.d/202.wip
Normal file
|
|
@ -0,0 +1 @@
|
|||
[Create and join rooms] Fix display of trailing icon in the search bar
|
||||
|
|
@ -154,18 +154,24 @@ fun CreateRoomSearchBar(
|
|||
leadingIcon = if (active) {
|
||||
{ BackButton(onClick = { onActiveChanged(false) }) }
|
||||
} else null,
|
||||
trailingIcon = {
|
||||
if (active) {
|
||||
IconButton(onClick = { onTextChanged("") }) {
|
||||
Icon(Icons.Default.Close, stringResource(StringR.string.a11y_clear))
|
||||
trailingIcon = when {
|
||||
active && text.isNotEmpty() -> {
|
||||
{
|
||||
IconButton(onClick = { onTextChanged("") }) {
|
||||
Icon(Icons.Default.Close, stringResource(StringR.string.a11y_clear))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Search,
|
||||
contentDescription = stringResource(StringR.string.search),
|
||||
modifier = Modifier.alpha(0.4f), // FIXME align on Design system theme (removing alpha should be fine)
|
||||
)
|
||||
}
|
||||
!active -> {
|
||||
{
|
||||
Icon(
|
||||
imageVector = Icons.Default.Search,
|
||||
contentDescription = stringResource(StringR.string.search),
|
||||
modifier = Modifier.alpha(0.4f), // FIXME align on Design system theme (removing alpha should be fine)
|
||||
)
|
||||
}
|
||||
}
|
||||
else -> null
|
||||
},
|
||||
shape = if (!active) SearchBarDefaults.dockedShape else SearchBarDefaults.fullScreenShape,
|
||||
colors = if (!active) SearchBarDefaults.colors() else SearchBarDefaults.colors(containerColor = Color.Transparent),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue