Skip to content

Commit

Permalink
[#597] Review: Fix a padding bug in cards
Browse files Browse the repository at this point in the history
  • Loading branch information
florentmaitre committed Sep 20, 2023
1 parent 329ee24 commit 361ef97
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package com.orange.ods.app.ui.components.cards

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
Expand Down Expand Up @@ -45,8 +44,8 @@ fun CardHorizontal(customizationState: CardCustomizationState) {
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(state = rememberScrollState())
.padding(dimensionResource(id = com.orange.ods.R.dimen.spacing_m))
.verticalScroll(state = rememberScrollState()),
) {
val firstButtonText = stringResource(id = R.string.component_element_first_button)
val secondButtonText = stringResource(id = R.string.component_element_second_button)
Expand All @@ -73,9 +72,9 @@ fun CardHorizontal(customizationState: CardCustomizationState) {
divider = hasDivider
)

Spacer(modifier = Modifier.padding(top = dimensionResource(com.orange.ods.R.dimen.spacing_s)))

CodeImplementationColumn {
CodeImplementationColumn(
modifier = Modifier.padding(top = dimensionResource(com.orange.ods.R.dimen.spacing_s))
) {
FunctionCallCode(
name = OdsComposable.OdsHorizontalCard.name,
exhaustiveParameters = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
Expand Down Expand Up @@ -47,8 +46,8 @@ fun CardSmall(customizationState: CardCustomizationState) {
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(state = rememberScrollState())
.padding(dimensionResource(id = com.orange.ods.R.dimen.spacing_m))
.verticalScroll(state = rememberScrollState()),
) {
Row(
modifier = Modifier
Expand Down Expand Up @@ -76,9 +75,9 @@ fun CardSmall(customizationState: CardCustomizationState) {
Box(modifier = Modifier.weight(0.5f))
}

Spacer(modifier = Modifier.padding(top = dimensionResource(com.orange.ods.R.dimen.spacing_s)))

CodeImplementationColumn {
CodeImplementationColumn(
modifier = Modifier.padding(top = dimensionResource(com.orange.ods.R.dimen.spacing_s))
) {
FunctionCallCode(
name = OdsComposable.OdsSmallCard.name,
exhaustiveParameters = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package com.orange.ods.app.ui.components.cards

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
Expand Down Expand Up @@ -48,8 +47,8 @@ fun CardVerticalHeaderFirst(customizationState: CardCustomizationState) {
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(state = rememberScrollState())
.padding(dimensionResource(id = com.orange.ods.R.dimen.spacing_m))
.verticalScroll(state = rememberScrollState()),
) {
val firstButtonText = stringResource(id = R.string.component_element_first_button)
val secondButtonText = stringResource(id = R.string.component_element_second_button)
Expand All @@ -76,9 +75,9 @@ fun CardVerticalHeaderFirst(customizationState: CardCustomizationState) {
secondButton = if (hasSecondButton) OdsCardButton(secondButtonText) { clickOnElement(context, secondButtonText) } else null,
)

Spacer(modifier = Modifier.padding(top = dimensionResource(com.orange.ods.R.dimen.spacing_s)))

CodeImplementationColumn {
CodeImplementationColumn(
modifier = Modifier.padding(top = dimensionResource(com.orange.ods.R.dimen.spacing_s))
) {
FunctionCallCode(
name = OdsComposable.OdsVerticalHeaderFirstCard.name,
exhaustiveParameters = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package com.orange.ods.app.ui.components.cards

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
Expand Down Expand Up @@ -45,8 +44,8 @@ fun CardVerticalImageFirst(customizationState: CardCustomizationState) {
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(state = rememberScrollState())
.padding(dimensionResource(id = com.orange.ods.R.dimen.spacing_m))
.verticalScroll(state = rememberScrollState()),
) {
val firstButtonText = stringResource(id = R.string.component_element_first_button)
val secondButtonText = stringResource(id = R.string.component_element_second_button)
Expand All @@ -71,9 +70,9 @@ fun CardVerticalImageFirst(customizationState: CardCustomizationState) {
secondButton = if (hasSecondButton) OdsCardButton(secondButtonText) { clickOnElement(context, secondButtonText) } else null,
)

Spacer(modifier = Modifier.padding(top = dimensionResource(com.orange.ods.R.dimen.spacing_s)))

CodeImplementationColumn {
CodeImplementationColumn(
modifier = Modifier.padding(top = dimensionResource(id = com.orange.ods.R.dimen.spacing_s))
) {
FunctionCallCode(
name = OdsComposable.OdsVerticalImageFirstCard.name,
exhaustiveParameters = false,
Expand Down

0 comments on commit 361ef97

Please sign in to comment.