Skip to content

Commit

Permalink
Fix margin issues with portfolio position items (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang authored Apr 11, 2024
1 parent 252e95d commit 68c881b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ object DydxPortfolioPositionItemView {
Row(
modifier = modifier
.padding(
// outer padding first, before widht and height
// outer padding first, before width and height
horizontal = ThemeShapes.HorizontalPadding,
vertical = ThemeShapes.VerticalPadding,
)
.fillMaxWidth()
.height((if (isIsolatedMarketEnabled) 148.dp else 64.dp) + ThemeShapes.VerticalPadding * 2)
.height((if (isIsolatedMarketEnabled) 148.dp else 48.dp) + ThemeShapes.VerticalPadding * 2)
.background(
brush = position.gradientType.brush(ThemeColor.SemanticColor.layer_3),
shape = shape,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package exchange.dydx.trading.feature.portfolio.components.positions
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
Expand Down Expand Up @@ -66,8 +65,10 @@ object DydxPortfolioPositionsView : DydxComponent {
val viewModel: DydxPortfolioPositionsViewModel = hiltViewModel()

val state = viewModel.state.collectAsStateWithLifecycle(initialValue = null).value
LazyColumn {
ListContent(this, modifier, state)
LazyColumn(
modifier = modifier,
) {
ListContent(this, Modifier, state)
}
}

Expand All @@ -76,28 +77,28 @@ object DydxPortfolioPositionsView : DydxComponent {

if (state.positions.isEmpty()) {
scope.item(key = "placeholder") {
DydxPortfolioPlaceholderView.Content(modifier.padding(vertical = 0.dp))
DydxPortfolioPlaceholderView.Content(Modifier.padding(vertical = 0.dp))
}
} else {
if (!state.isIsolatedMarketEnabled) {
scope.item(key = "header") {
CreateHeader(modifier, state)
CreateHeader(Modifier, state)
}
}

scope.items(items = state.positions, key = { it.id }) { position ->
if (!state.isIsolatedMarketEnabled && position === state.positions.first()) {
Spacer(modifier = Modifier.height(16.dp))
}
// if (!state.isIsolatedMarketEnabled && position === state.positions.first()) {
// Spacer(modifier = Modifier.height(16.dp))
// }
DydxPortfolioPositionItemView.Content(
modifier = modifier,
modifier = Modifier,
localizer = state.localizer,
position = position,
isIsolatedMarketEnabled = state.isIsolatedMarketEnabled,
onTapAction = state.onPositionTapAction,
)

Spacer(modifier = Modifier.height(10.dp))
// Spacer(modifier = Modifier.height(10.dp))
}
}
}
Expand Down

0 comments on commit 68c881b

Please sign in to comment.