Skip to content

Commit

Permalink
[#459] Change code implementation composables and display two steps f…
Browse files Browse the repository at this point in the history
…or snackbar component
  • Loading branch information
paulinea committed Apr 11, 2023
1 parent 6e06b9d commit 95c8769
Show file tree
Hide file tree
Showing 29 changed files with 387 additions and 324 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ import com.orange.ods.app.ui.LocalMainTopAppBarManager
import com.orange.ods.app.ui.TopAppBarConfiguration
import com.orange.ods.app.ui.components.utilities.ComponentCountRow
import com.orange.ods.app.ui.components.utilities.ComponentCustomizationBottomSheetScaffold
import com.orange.ods.app.ui.utilities.composable.CodeImplementation
import com.orange.ods.app.ui.utilities.composable.CodeImplementation.Companion.IconPainterValue
import com.orange.ods.app.ui.utilities.composable.CodeImplementationColumn
import com.orange.ods.app.ui.utilities.composable.CodeParameter
import com.orange.ods.app.ui.utilities.composable.ComponentCode
import com.orange.ods.app.ui.utilities.composable.ComposableParameter
import com.orange.ods.app.ui.utilities.composable.IconPainterValue
import com.orange.ods.app.ui.utilities.composable.TextValueParameter
import com.orange.ods.compose.component.OdsComponent
import com.orange.ods.compose.component.list.OdsListItem
Expand Down Expand Up @@ -76,61 +77,64 @@ fun ComponentTopAppBar() {

}) {

Column(
modifier = Modifier
.verticalScroll(rememberScrollState())
) {
CodeImplementation(OdsComponent.OdsTopAppBar.name).CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin)),
codeParameters = mutableListOf<CodeParameter>(
TextValueParameter.Title(stringResource(id = R.string.component_app_bars_top_regular))
).apply {
if (isNavigationIconEnabled) add(ComposableParameter(
name = "navigationIcon",
value = {
CodeImplementation("Icon").ComponentCode(
parameters = listOf(
TextValueParameter.ValueOnlyParameter("imageVector", "<image vector>"),
TextValueParameter.ContentDescription(stringResource(id = R.string.top_app_bar_back_icon_desc))
)
)
}
))

add(ComposableParameter(
name = "actions",
value = {
repeat(actionCount.value) {
CodeImplementation("OdsTopAppBarActionButton").ComponentCode(
Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
CodeImplementationColumn(modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin))) {
ComponentCode(
name = OdsComponent.OdsTopAppBar.name,
parameters = mutableListOf<CodeParameter>(
TextValueParameter.Title(stringResource(id = R.string.component_app_bars_top_regular))
).apply {
if (isNavigationIconEnabled) add(ComposableParameter(
name = "navigationIcon",
value = {
ComponentCode(
name = "Icon",
parameters = listOf(
TextValueParameter.OnClick,
TextValueParameter.ValueOnlyParameter("painter", IconPainterValue),
TextValueParameter.ContentDescription("icon description")
TextValueParameter.ValueOnlyParameter("imageVector", "<image vector>"),
TextValueParameter.ContentDescription(stringResource(id = R.string.top_app_bar_back_icon_desc))
)
)
}
if (isOverflowMenuEnabled) {
CodeImplementation("OdsTopAppBarOverflowMenuBox").ComponentCode(
parameters = listOf(
TextValueParameter.BetweenQuotesParameter("overflowIconContentDescription", "Open overflow menu"),
))

add(ComposableParameter(
name = "actions",
value = {
repeat(actionCount.value) {
ComponentCode(
name = "OdsTopAppBarActionButton",
parameters = listOf(
TextValueParameter.OnClick,
TextValueParameter.ValueOnlyParameter("painter", IconPainterValue),
TextValueParameter.ContentDescription("icon description")
)
)
) {
for (i in 1..2) {
CodeImplementation("OdsDropdownMenuItem").ComponentCode(
parameters = listOf(
TextValueParameter.BetweenQuotesParameter("text", "Menu $i"),
TextValueParameter.OnClick
)
}
if (isOverflowMenuEnabled) {
ComponentCode(
name = "OdsTopAppBarOverflowMenuBox",
parameters = listOf(
TextValueParameter.BetweenQuotesParameter("overflowIconContentDescription", "Open overflow menu"),
)
) {
for (i in 1..2) {
ComponentCode(
name = "OdsDropdownMenuItem",
parameters = listOf(
TextValueParameter.BetweenQuotesParameter("text", "Menu $i"),
TextValueParameter.OnClick
)
)

}
}

}
}
}
}
))
}
)
))
}
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import com.orange.ods.app.domain.recipes.LocalRecipes
import com.orange.ods.app.ui.components.utilities.ComponentCountRow
import com.orange.ods.app.ui.components.utilities.ComponentCustomizationBottomSheetScaffold
import com.orange.ods.app.ui.components.utilities.clickOnElement
import com.orange.ods.app.ui.utilities.composable.CodeImplementation
import com.orange.ods.app.ui.utilities.composable.CodeImplementationColumn
import com.orange.ods.app.ui.utilities.composable.ComponentCode
import com.orange.ods.app.ui.utilities.composable.TextValueParameter
import com.orange.ods.compose.component.OdsComponent
import com.orange.ods.compose.component.banner.OdsBanner
Expand Down Expand Up @@ -92,18 +93,19 @@ fun ComponentBanners() {
onButton2Click = { clickOnElement(context, button2Text) }
)

CodeImplementation(OdsComponent.OdsBanner.name).CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin)),
codeParameters = mutableListOf<TextValueParameter>(
CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin))
) {
ComponentCode(name = OdsComponent.OdsBanner.name, parameters = mutableListOf<TextValueParameter>(
TextValueParameter.BetweenQuotesParameter("message", if (hasTwoTextLines) recipe.description else recipe.title),
TextValueParameter.Button1Text(stringResource(id = R.string.component_banner_dismiss)),
).apply {
if (hasImage) add(TextValueParameter.Image)
if (hasButton2) add(
TextValueParameter.Button2Text(stringResource(id = R.string.component_banner_detail))
)
}
)
})
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import com.orange.ods.app.ui.components.utilities.ComponentCountRow
import com.orange.ods.app.ui.components.utilities.ComponentCustomizationBottomSheetScaffold
import com.orange.ods.app.ui.components.utilities.clickOnElement
import com.orange.ods.app.ui.utilities.NavigationItem
import com.orange.ods.app.ui.utilities.composable.CodeImplementation
import com.orange.ods.app.ui.utilities.composable.CodeImplementationColumn
import com.orange.ods.app.ui.utilities.composable.ComponentCode
import com.orange.ods.app.ui.utilities.composable.TextValueParameter
import com.orange.ods.compose.component.OdsComponent
import com.orange.ods.compose.component.bottomnavigation.OdsBottomNavigation
Expand Down Expand Up @@ -93,18 +94,21 @@ fun ComponentBottomNavigation() {
}
}

CodeImplementation(OdsComponent.OdsBottomNavigation.name).CodeImplementationColumn(
CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin))
) {
navigationItems.take(2).forEach { item ->
CodeImplementation("OdsBottomNavigationItem").ComponentCode(
parameters = listOf(
TextValueParameter.Icon,
TextValueParameter.BetweenQuotesParameter("label", stringResource(id = item.textResId)),
TextValueParameter.Selected(selectedNavigationItem.value.textResId == item.textResId),
TextValueParameter.OnClick,
ComponentCode(name = OdsComponent.OdsBottomNavigation.name) {
navigationItems.take(2).forEach { item ->
ComponentCode(
name = "OdsBottomNavigationItem",
parameters = listOf(
TextValueParameter.Icon,
TextValueParameter.BetweenQuotesParameter("label", stringResource(id = item.textResId)),
TextValueParameter.Selected(selectedNavigationItem.value.textResId == item.textResId),
TextValueParameter.OnClick,
)
)
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import com.orange.ods.app.R
import com.orange.ods.app.ui.components.utilities.ComponentCustomizationBottomSheetScaffold
import com.orange.ods.app.ui.utilities.composable.CodeImplementation
import com.orange.ods.app.ui.utilities.composable.CodeImplementationColumn
import com.orange.ods.app.ui.utilities.composable.ComponentCode
import com.orange.ods.app.ui.utilities.composable.Subtitle
import com.orange.ods.app.ui.utilities.composable.TextValueParameter
import com.orange.ods.app.ui.utilities.composable.Title
Expand Down Expand Up @@ -103,16 +104,17 @@ fun ButtonsContained(style: OdsButtonStyle) {
)
}

CodeImplementation(OdsComponent.OdsButton.name).CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin)),
codeParameters = mutableListOf<TextValueParameter>(
CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin))
) {
ComponentCode(name = OdsComponent.OdsButton.name, parameters = mutableListOf<TextValueParameter>(
TextValueParameter.ValueOnlyParameter("style", containedButtonStyle.value.fullName)
).apply {
if (hasFullScreenWidth) add(TextValueParameter.FillMaxWidth)
if (hasLeadingIcon) add(TextValueParameter.Icon)
if (!isEnabled) add(TextValueParameter.Enabled(false))
}
)
})
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import androidx.compose.ui.res.stringResource
import com.orange.ods.app.R
import com.orange.ods.app.ui.components.utilities.ComponentCustomizationBottomSheetScaffold
import com.orange.ods.app.ui.components.utilities.clickOnElement
import com.orange.ods.app.ui.utilities.composable.CodeImplementation
import com.orange.ods.app.ui.utilities.composable.CodeImplementationColumn
import com.orange.ods.app.ui.utilities.composable.ComponentCode
import com.orange.ods.app.ui.utilities.composable.TextValueParameter
import com.orange.ods.compose.component.OdsComponent
import com.orange.ods.compose.component.button.OdsIconButton
Expand Down Expand Up @@ -81,14 +82,15 @@ fun ButtonsIcon() {
)
}

CodeImplementation(OdsComponent.OdsIconButton.name).CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin)),
codeParameters = mutableListOf<TextValueParameter>(
CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin))
) {
ComponentCode(name = OdsComponent.OdsIconButton.name, parameters = mutableListOf<TextValueParameter>(
TextValueParameter.Icon
).apply {
if (!isEnabled) add(TextValueParameter.Enabled(false))
}
)
})
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import com.orange.ods.app.R
import com.orange.ods.app.ui.components.utilities.ComponentCustomizationBottomSheetScaffold
import com.orange.ods.app.ui.utilities.composable.CodeImplementation
import com.orange.ods.app.ui.utilities.composable.CodeImplementationColumn
import com.orange.ods.app.ui.utilities.composable.ComponentCode
import com.orange.ods.app.ui.utilities.composable.TextValueParameter
import com.orange.ods.compose.component.OdsComponent
import com.orange.ods.compose.component.button.OdsOutlinedButton
Expand Down Expand Up @@ -74,14 +75,15 @@ fun ButtonsOutlined() {
)
}

CodeImplementation(OdsComponent.OdsOutlinedButton.name).CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin)),
codeParameters = mutableListOf<TextValueParameter>().apply {
CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin))
) {
ComponentCode(name = OdsComponent.OdsOutlinedButton.name, parameters = mutableListOf<TextValueParameter>().apply {
if (hasFullScreenWidth) add(TextValueParameter.FillMaxWidth)
if (hasLeadingIcon) add(TextValueParameter.Icon)
if (!isEnabled) add(TextValueParameter.Enabled(false))
}
)
})
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import com.orange.ods.app.R
import com.orange.ods.app.ui.components.utilities.ComponentCustomizationBottomSheetScaffold
import com.orange.ods.app.ui.utilities.composable.CodeImplementation
import com.orange.ods.app.ui.utilities.composable.CodeImplementationColumn
import com.orange.ods.app.ui.utilities.composable.ComponentCode
import com.orange.ods.app.ui.utilities.composable.Subtitle
import com.orange.ods.app.ui.utilities.composable.TextValueParameter
import com.orange.ods.app.ui.utilities.composable.Title
Expand Down Expand Up @@ -95,16 +96,16 @@ fun ButtonsText() {
)
}

CodeImplementation(OdsComponent.OdsTextButton.name).CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin)),
codeParameters = mutableListOf<TextValueParameter>(
CodeImplementationColumn(
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.screen_horizontal_margin))) {
ComponentCode(name = OdsComponent.OdsTextButton.name, parameters = mutableListOf<TextValueParameter>(
TextValueParameter.ValueOnlyParameter("style", textButtonStyle.value.fullName)
).apply {
if (hasFullScreenWidth) add(TextValueParameter.FillMaxWidth)
if (hasLeadingIcon) add(TextValueParameter.Icon)
if (!isEnabled) add(TextValueParameter.Enabled(false))
}
)
})
}
}
}
}
Expand Down
Loading

0 comments on commit 95c8769

Please sign in to comment.