Skip to content

Commit

Permalink
Use custom ScrollableTabRow for Chart periods
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelekol committed Jun 24, 2024
1 parent 13ccf5a commit ceae7cb
Show file tree
Hide file tree
Showing 5 changed files with 384 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Icon
import androidx.compose.material.ScrollableTabRow
import androidx.compose.material.Tab
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -64,6 +63,7 @@ import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme
import io.horizontalsystems.bankwallet.ui.compose.components.GraphicBars
import io.horizontalsystems.bankwallet.ui.compose.components.GraphicBarsWithNegative
import io.horizontalsystems.bankwallet.ui.compose.components.HSpacer
import io.horizontalsystems.bankwallet.ui.compose.components.HsPeriodsScrollableTabRow
import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal
import io.horizontalsystems.bankwallet.ui.compose.components.TabButtonSecondaryTransparent
import io.horizontalsystems.bankwallet.ui.compose.components.TabItem
Expand Down Expand Up @@ -702,28 +702,31 @@ fun <T> ChartTab(modifier: Modifier = Modifier, tabItems: List<TabItem<T>>, onSe
val tabIndex = tabItems.indexOfFirst { it.selected }

TabPeriod(modifier = modifier) {
ScrollableTabRow(
HsPeriodsScrollableTabRow(
selectedTabIndex = tabIndex,
modifier = Modifier,
backgroundColor = Color.Transparent,
edgePadding = 0.dp,
edgePadding = 12.dp,
indicator = {},
divider = {}
) {
tabItems.forEachIndexed { index, tabItem ->
val selected = tabIndex == index

Tab(
selected = selected,
onClick = { },
Row(
modifier = Modifier.padding(horizontal = 4.dp)
) {
TabButtonSecondaryTransparent(
title = tabItem.title,
onSelect = {
onSelect.invoke(tabItem.item)
},
selected = selected
)
Tab(
selected = selected,
onClick = { },
) {
TabButtonSecondaryTransparent(
title = tabItem.title,
onSelect = {
onSelect.invoke(tabItem.item)
},
selected = selected
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fun SuggestionsBar(
Text(
text = "$percent%",
modifier = modifier,
style = ComposeAppTheme.typography.subhead1,
style = ComposeAppTheme.typography.captionSB,
color = if (selectEnabled) {
ComposeAppTheme.colors.leah
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ import io.horizontalsystems.bankwallet.ui.compose.components.SelectorItem
import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantWarning
import io.horizontalsystems.bankwallet.ui.compose.components.body_grey50
import io.horizontalsystems.bankwallet.ui.compose.components.body_leah
import io.horizontalsystems.bankwallet.ui.compose.components.captionSB_leah
import io.horizontalsystems.bankwallet.ui.compose.components.caption_lucian
import io.horizontalsystems.bankwallet.ui.compose.components.subhead1_leah
import io.horizontalsystems.bankwallet.ui.compose.observeKeyboardState
import io.horizontalsystems.core.helpers.HudHelper
import kotlinx.coroutines.CoroutineScope
Expand Down Expand Up @@ -522,7 +522,7 @@ fun SuggestionsBar(
onClick.invoke(wordItem, suggestion)
}
) {
subhead1_leah(text = suggestion)
captionSB_leah(text = suggestion)
}
Spacer(modifier = Modifier.width(12.dp))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ fun ButtonSecondary(
enabled = enabled,
) {
ProvideTextStyle(
value = ComposeAppTheme.typography.subhead1
value = ComposeAppTheme.typography.captionSB
) {
Row(
Modifier
Expand Down
Loading

0 comments on commit ceae7cb

Please sign in to comment.