Skip to content

Commit

Permalink
Disable search in feeds sheet when entering link
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Oct 27, 2023
1 parent f4eb21c commit fbab6ca
Showing 1 changed file with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,17 @@ private fun SearchBar(
WindowInsets.systemBars.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal)
)
) {
val background =
when (feedsSheetMode) {
Default,
Edit -> AppTheme.colorScheme.tintedSurface
LinkEntry -> AppTheme.colorScheme.tintedBackground
}

Box(
modifier =
Modifier.padding(all = 16.dp)
.background(color = AppTheme.colorScheme.tintedSurface, shape = RoundedCornerShape(16.dp))
.background(color = background, shape = RoundedCornerShape(16.dp))
.padding(horizontal = 4.dp)
) {
MaterialTheme(
Expand All @@ -442,11 +449,13 @@ private fun SearchBar(
value = query.copy(selection = TextRange(query.text.length)),
onValueChange = onQueryChange,
placeholder = {
Text(
text = LocalStrings.current.feedsSearchHint,
color = AppTheme.colorScheme.textEmphasisHigh,
style = MaterialTheme.typography.bodyLarge
)
if (feedsSheetMode != LinkEntry) {
Text(
text = LocalStrings.current.feedsSearchHint,
color = AppTheme.colorScheme.textEmphasisHigh,
style = MaterialTheme.typography.bodyLarge
)
}
},
leadingIcon = {
val icon =
Expand All @@ -467,11 +476,14 @@ private fun SearchBar(
shape = RoundedCornerShape(16.dp),
singleLine = true,
textStyle = MaterialTheme.typography.bodyLarge,
enabled = feedsSheetMode != LinkEntry,
colors =
TextFieldDefaults.colors(
focusedContainerColor = Color.Unspecified,
unfocusedContainerColor = Color.Unspecified,
disabledContainerColor = Color.Unspecified,
focusedTextColor = AppTheme.colorScheme.textEmphasisHigh,
disabledTextColor = Color.Unspecified,
unfocusedIndicatorColor = Color.Unspecified,
focusedIndicatorColor = Color.Unspecified,
disabledIndicatorColor = Color.Unspecified,
Expand Down

0 comments on commit fbab6ca

Please sign in to comment.