Skip to content

Commit

Permalink
Refactor: Changes in WrapModalBottomSheet.
Browse files Browse the repository at this point in the history
- Removed `backgroundPaper` color and replaced it with `background`.
- Updated the `WrapModalBottomSheet` to use consistent padding values.
  • Loading branch information
gstamatop committed Sep 26, 2024
1 parent beaf94c commit 898ce3e
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import eu.europa.ec.resourceslogic.R
import eu.europa.ec.resourceslogic.theme.values.backgroundPaper
import eu.europa.ec.resourceslogic.theme.values.bottomCorneredShapeSmall
import eu.europa.ec.uilogic.component.AppIcons
import eu.europa.ec.uilogic.component.preview.PreviewTheme
Expand Down Expand Up @@ -106,7 +105,7 @@ private fun Content(
.fillMaxWidth()
.fillMaxHeight(animatedWeight)
.background(
color = MaterialTheme.colorScheme.backgroundPaper,
color = MaterialTheme.colorScheme.background,
shape = MaterialTheme.shapes.bottomCorneredShapeSmall
),
contentAlignment = Alignment.Center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ data class ThemeColorsTemplate(
surfaceContainer = Color.Unspecified,
surfaceContainerHigh = Color.Unspecified,
surfaceContainerHighest = Color.Unspecified,
surfaceContainerLow = Color.Unspecified,
surfaceContainerLow = Color(background),
surfaceContainerLowest = Color.Unspecified
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class ThemeColors {
internal const val eudiw_theme_light_textDisabledDark: Long = 0x61000000
internal const val eudiw_theme_light_dividerDark: Long = 0x1F000000
internal const val eudiw_theme_light_backgroundDefault: Long = 0xFFF5F5F5
const val eudiw_theme_light_backgroundPaper: Long = 0xFFFFFFFF
internal const val eudiw_theme_light_textSecondaryLight: Long = 0xB3FFFFFF
internal const val eudiw_theme_light_textDisabledLight: Long = 0x80FFFFFF

Expand All @@ -64,7 +63,6 @@ class ThemeColors {
internal const val eudiw_theme_dark_textDisabledDark: Long = 0xFF646670
internal const val eudiw_theme_dark_dividerDark: Long = 0x1FFFFFFF
internal const val eudiw_theme_dark_backgroundDefault: Long = 0xFF44474F
const val eudiw_theme_dark_backgroundPaper: Long = 0xFF000000
internal const val eudiw_theme_dark_textSecondaryLight: Long = 0xB3000000
internal const val eudiw_theme_dark_textDisabledLight: Long = 0x80000000

Expand All @@ -85,7 +83,7 @@ class ThemeColors {
private const val eudiw_theme_light_errorContainer: Long = 0xFFFFDAD5
private const val eudiw_theme_light_onError: Long = white
private const val eudiw_theme_light_onErrorContainer: Long = 0xFF410002
private const val eudiw_theme_light_background: Long = white
const val eudiw_theme_light_background: Long = white
private const val eudiw_theme_light_onBackground: Long = black
private const val eudiw_theme_light_surface: Long = white
private const val eudiw_theme_light_onSurface: Long = black
Expand Down Expand Up @@ -116,7 +114,7 @@ class ThemeColors {
private const val eudiw_theme_dark_errorContainer: Long = 0xFF930009
private const val eudiw_theme_dark_onError: Long = 0xFF690004
private const val eudiw_theme_dark_onErrorContainer: Long = 0xFFFFDAD5
private const val eudiw_theme_dark_background: Long = black
const val eudiw_theme_dark_background: Long = black
private const val eudiw_theme_dark_onBackground: Long = white
private const val eudiw_theme_dark_surface: Long = black
private const val eudiw_theme_dark_onSurface: Long = white
Expand Down Expand Up @@ -278,13 +276,6 @@ class ThemeColors {
Color(eudiw_theme_light_backgroundDefault)
}

val backgroundPaper: Color
get() = if (isInDarkMode) {
Color(eudiw_theme_dark_backgroundPaper)
} else {
Color(eudiw_theme_light_backgroundPaper)
}

val textSecondaryLight: Color
get() = if (isInDarkMode) {
Color(eudiw_theme_dark_textSecondaryLight)
Expand Down Expand Up @@ -338,13 +329,6 @@ val ColorScheme.backgroundDefault: Color
Color(ThemeColors.eudiw_theme_light_backgroundDefault)
}

val ColorScheme.backgroundPaper: Color
@Composable get() = if (isSystemInDarkTheme()) {
Color(ThemeColors.eudiw_theme_dark_backgroundPaper)
} else {
Color(ThemeColors.eudiw_theme_light_backgroundPaper)
}

val ColorScheme.textSecondaryLight: Color
@Composable get() = if (isSystemInDarkTheme()) {
Color(ThemeColors.eudiw_theme_dark_textSecondaryLight)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.navigation.NavController
import eu.europa.ec.resourceslogic.theme.values.backgroundPaper
import eu.europa.ec.uilogic.component.AppIcons
import eu.europa.ec.uilogic.component.utils.OneTimeLaunchedEffect
import eu.europa.ec.uilogic.component.wrap.WrapImage
Expand Down Expand Up @@ -89,7 +88,7 @@ private fun Content(
Modifier
.fillMaxSize()
.padding(paddingValues)
.background(MaterialTheme.colorScheme.backgroundPaper),
.background(MaterialTheme.colorScheme.background),
contentAlignment = Alignment.Center
) {
AnimatedVisibility(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import eu.europa.ec.resourceslogic.theme.values.backgroundPaper
import eu.europa.ec.uilogic.component.content.ToolBarActions
import eu.europa.ec.uilogic.component.content.ToolbarAction
import eu.europa.ec.uilogic.component.preview.PreviewTheme
Expand Down Expand Up @@ -59,7 +58,7 @@ fun ActionTopBar(
private fun TopBarPreview() {
PreviewTheme {
ActionTopBar(
contentColor = MaterialTheme.colorScheme.backgroundPaper,
contentColor = MaterialTheme.colorScheme.background,
iconColor = MaterialTheme.colorScheme.primary,
iconData = AppIcons.Close
) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import eu.europa.ec.resourceslogic.theme.values.backgroundPaper
import eu.europa.ec.uilogic.component.preview.PreviewTheme
import eu.europa.ec.uilogic.component.preview.ThemeModePreviews
import eu.europa.ec.uilogic.component.utils.SIZE_EXTRA_LARGE
Expand All @@ -42,7 +41,7 @@ enum class GradientEdge {
@Composable
fun ContentGradient(
modifier: Modifier,
gradientStartColor: Color = MaterialTheme.colorScheme.backgroundPaper,
gradientStartColor: Color = MaterialTheme.colorScheme.background,
gradientEndColor: Color = Color.Transparent,
gradientEdge: GradientEdge = GradientEdge.BOTTOM,
height: Dp = SIZE_EXTRA_LARGE.dp,
Expand Down Expand Up @@ -139,7 +138,7 @@ private fun ContentGradientColoredPreview() {
Box(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colorScheme.backgroundPaper)
.background(MaterialTheme.colorScheme.background)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import eu.europa.ec.resourceslogic.theme.values.ThemeColors
* */
@Preview(
name = "Light Mode", showBackground = true, uiMode = UI_MODE_NIGHT_NO,
backgroundColor = ThemeColors.eudiw_theme_light_backgroundPaper
backgroundColor = ThemeColors.eudiw_theme_light_background
)
@Preview(
name = "Dark Mode", showBackground = true, uiMode = UI_MODE_NIGHT_YES,
backgroundColor = ThemeColors.eudiw_theme_dark_backgroundPaper
backgroundColor = ThemeColors.eudiw_theme_dark_background
)
annotation class ThemeModePreviews
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import eu.europa.ec.resourceslogic.theme.values.backgroundPaper
import eu.europa.ec.resourceslogic.theme.values.dividerDark
import eu.europa.ec.resourceslogic.theme.values.textDisabledDark
import eu.europa.ec.resourceslogic.theme.values.textPrimaryDark
Expand All @@ -49,7 +48,7 @@ fun WrapPrimaryButton(
val textColor = if (isSystemInDarkTheme()) {
Color.White
} else {
MaterialTheme.colorScheme.backgroundPaper
MaterialTheme.colorScheme.background
}

Button(
Expand Down Expand Up @@ -81,9 +80,9 @@ fun WrapSecondaryButton(
onClick = onClick,
shape = buttonsShape,
colors = ButtonDefaults.outlinedButtonColors(
containerColor = MaterialTheme.colorScheme.backgroundPaper,
containerColor = MaterialTheme.colorScheme.background,
contentColor = MaterialTheme.colorScheme.textPrimaryDark,
disabledContainerColor = MaterialTheme.colorScheme.backgroundPaper,
disabledContainerColor = MaterialTheme.colorScheme.background,
disabledContentColor = MaterialTheme.colorScheme.textDisabledDark,
),
border = BorderStroke(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import eu.europa.ec.resourceslogic.theme.values.allCorneredShapeLarge
import eu.europa.ec.resourceslogic.theme.values.backgroundPaper
import eu.europa.ec.resourceslogic.theme.values.textPrimaryDark
import eu.europa.ec.uilogic.component.AppIcons
import eu.europa.ec.uilogic.component.preview.PreviewTheme
Expand All @@ -41,14 +40,14 @@ private val primaryFabContentColor: Color
@Composable get() = if (isSystemInDarkTheme()) {
Color.White
} else {
MaterialTheme.colorScheme.backgroundPaper
MaterialTheme.colorScheme.background
}

private val secondaryFabContainerColor: Color
@Composable get() = if (isSystemInDarkTheme()) {
Color.DarkGray
} else {
MaterialTheme.colorScheme.backgroundPaper
MaterialTheme.colorScheme.background
}

private val secondaryFabContentColor: Color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
Expand All @@ -41,21 +41,23 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.dp
import eu.europa.ec.resourceslogic.theme.values.backgroundDefault
import eu.europa.ec.resourceslogic.theme.values.backgroundPaper
import eu.europa.ec.resourceslogic.theme.values.textPrimaryDark
import eu.europa.ec.resourceslogic.theme.values.textSecondaryDark
import eu.europa.ec.uilogic.component.ModalOptionUi
import eu.europa.ec.uilogic.component.preview.PreviewTheme
import eu.europa.ec.uilogic.component.preview.ThemeModePreviews
import eu.europa.ec.uilogic.component.utils.SIZE_SMALL
import eu.europa.ec.uilogic.component.utils.SPACING_EXTRA_LARGE
import eu.europa.ec.uilogic.component.utils.SPACING_LARGE
import eu.europa.ec.uilogic.component.utils.SPACING_MEDIUM
import eu.europa.ec.uilogic.component.utils.SPACING_SMALL
import eu.europa.ec.uilogic.component.utils.VSpacer
import eu.europa.ec.uilogic.extension.throttledClickable
import eu.europa.ec.uilogic.mvi.ViewEvent

private val defaultBottomSheetPadding: PaddingValues = PaddingValues(
all = SPACING_LARGE.dp
)

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun WrapModalBottomSheet(
Expand All @@ -73,7 +75,6 @@ fun WrapModalBottomSheet(
shape = shape,
dragHandle = dragHandle,
content = sheetContent,
contentWindowInsets = { WindowInsets(0, 0, 0, 0) }
)
}

Expand All @@ -85,9 +86,9 @@ fun GenericBaseSheetContent(
Column(
modifier = Modifier
.wrapContentHeight()
.background(color = MaterialTheme.colorScheme.backgroundPaper)
.background(color = MaterialTheme.colorScheme.background)
.fillMaxWidth()
.padding(horizontal = 32.dp, vertical = 48.dp)
.padding(defaultBottomSheetPadding)
) {
Text(
text = title,
Expand All @@ -108,14 +109,9 @@ fun GenericBaseSheetContent(
Column(
modifier = Modifier
.wrapContentHeight()
.background(color = MaterialTheme.colorScheme.backgroundPaper)
.background(color = MaterialTheme.colorScheme.background)
.fillMaxWidth()
.padding(
start = SPACING_LARGE.dp,
top = SPACING_LARGE.dp,
end = SPACING_LARGE.dp,
bottom = SPACING_EXTRA_LARGE.dp
)
.padding(defaultBottomSheetPadding)
) {
titleContent()
VSpacer.Large()
Expand Down Expand Up @@ -204,7 +200,7 @@ fun <T : ViewEvent> BottomSheetWithOptionsList(
}

@Composable
fun <T : ViewEvent> OptionsList(
private fun <T : ViewEvent> OptionsList(
optionItems: List<ModalOptionUi<T>>,
itemSelected: (T) -> Unit
) {
Expand All @@ -221,7 +217,7 @@ fun <T : ViewEvent> OptionsList(
}

@Composable
fun <T : ViewEvent> OptionListItem(
private fun <T : ViewEvent> OptionListItem(
item: ModalOptionUi<T>,
itemSelected: (T) -> Unit
) {
Expand Down

0 comments on commit 898ce3e

Please sign in to comment.