Updated on 2026-08-14

This commit is contained in:
Tangem 2026-01-19 10:20:24 +01:00
parent 5aaf87d370
commit 8f2c28715a
3 changed files with 29 additions and 13 deletions

View file

@ -25,7 +25,10 @@ internal class DefaultFeedComponent(
@Composable
override fun Title(bottomSheetState: State<BottomSheetState>) {
val state by feedComponentModel.state.collectAsStateWithLifecycle()
FeedListHeader(state.feedListSearchBar)
FeedListHeader(
isSearchBarClickable = bottomSheetState.value == BottomSheetState.EXPANDED,
feedListSearchBar = state.feedListSearchBar,
)
}
@Composable

View file

@ -46,6 +46,7 @@ import com.tangem.core.ui.components.block.TangemBlockCardColors
import com.tangem.core.ui.components.buttons.SecondarySmallButton
import com.tangem.core.ui.components.buttons.SmallButtonConfig
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.conditional
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.stringResourceSafe
import com.tangem.core.ui.res.LocalMainBottomSheetColor
@ -56,9 +57,14 @@ import com.tangem.features.feed.ui.feed.preview.FeedListPreviewDataProvider.crea
import com.tangem.features.feed.ui.feed.state.*
@Composable
internal fun FeedListHeader(feedListSearchBar: FeedListSearchBar, modifier: Modifier = Modifier) {
internal fun FeedListHeader(
isSearchBarClickable: Boolean,
feedListSearchBar: FeedListSearchBar,
modifier: Modifier = Modifier,
) {
val background = LocalMainBottomSheetColor.current.value
FeedSearchBar(
isSearchBarClickable = isSearchBarClickable,
feedListSearchBar = feedListSearchBar,
modifier = modifier
.drawBehind { drawRect(background) }
@ -102,13 +108,19 @@ internal fun FeedList(state: FeedListUM, modifier: Modifier = Modifier) {
}
@Composable
private fun FeedSearchBar(feedListSearchBar: FeedListSearchBar, modifier: Modifier = Modifier) {
private fun FeedSearchBar(
isSearchBarClickable: Boolean,
feedListSearchBar: FeedListSearchBar,
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(36.dp))
.background(color = TangemTheme.colors.field.focused)
.clickable(onClick = feedListSearchBar.onBarClick)
.conditional(condition = isSearchBarClickable) {
clickable(onClick = feedListSearchBar.onBarClick)
}
.padding(14.dp),
) {
Icon(

View file

@ -449,20 +449,21 @@ private inline fun BaseScaffoldWithMarkets(
}
Column(
modifier = Modifier.sizeIn(maxHeight = maxHeight - statusBarHeight),
modifier = Modifier
// expand bottom sheet when clicked on the header
.clickable(
enabled = bottomSheetState.currentValue == TangemSheetValue.PartiallyExpanded,
indication = null,
interactionSource = null,
) {
coroutineScope.launch { bottomSheetState.expand() }
}
.sizeIn(maxHeight = maxHeight - statusBarHeight),
) {
Hand(Modifier.drawBehind { drawRect(backgroundColor.value) })
Box(
modifier = Modifier
// expand bottom sheet when clicked on the header
.clickable(
enabled = bottomSheetState.currentValue == TangemSheetValue.PartiallyExpanded,
indication = null,
interactionSource = null,
) {
coroutineScope.launch { bottomSheetState.expand() }
}
.onFocusChanged {
isSearchFieldFocused = it.isFocused
},