Skip to content

Commit

Permalink
Rename OudsContrastedSurface to OudsColoredSurface
Browse files Browse the repository at this point in the history
  • Loading branch information
florentmaitre committed Dec 30, 2024
1 parent 881a926 commit 47b334c
Show file tree
Hide file tree
Showing 29 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Software description: Android library of reusable graphical components
*/

package com.orange.ouds.core.component.contrastedsurface
package com.orange.ouds.core.component.coloredsurface

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.padding
Expand All @@ -24,7 +24,7 @@ import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.tooling.preview.PreviewParameter
import com.orange.ouds.core.component.button.OudsButton
import com.orange.ouds.core.theme.LocalContrastedSurface
import com.orange.ouds.core.theme.LocalColoredSurface
import com.orange.ouds.core.theme.value
import com.orange.ouds.core.utilities.OudsPreview
import com.orange.ouds.foundation.utilities.BasicPreviewParameterProvider
Expand All @@ -44,13 +44,13 @@ import com.orange.ouds.theme.tokens.OudsSpaceKeyToken
* @param content The content of this colored surface.
*/
@Composable
fun OudsContrastedSurface(
fun OudsColoredSurface(
color: OudsColorKeyToken.Surface,
modifier: Modifier = Modifier,
shape: Shape = RectangleShape,
content: @Composable () -> Unit
) {
CompositionLocalProvider(LocalContrastedSurface provides color) {
CompositionLocalProvider(LocalColoredSurface provides color) {
Surface(
modifier = modifier,
shape = shape,
Expand Down Expand Up @@ -83,21 +83,21 @@ private fun contentColorFor(color: OudsColorKeyToken.Surface): Color {
@Suppress("PreviewShouldNotBeCalledRecursively")
@UiModePreviews.Default
@Composable
private fun PreviewOudsContrastedSurface(@PreviewParameter(OudsContrastedSurfacePreviewParameterProvider::class) parameter: OudsColorKeyToken.Surface) {
PreviewOudsContrastedSurface(darkThemeEnabled = isSystemInDarkTheme(), parameter = parameter)
private fun PreviewOudsColoredSurface(@PreviewParameter(OudsColoredSurfacePreviewParameterProvider::class) parameter: OudsColorKeyToken.Surface) {
PreviewOudsColoredSurface(darkThemeEnabled = isSystemInDarkTheme(), parameter = parameter)
}

@Composable
internal fun PreviewOudsContrastedSurface(darkThemeEnabled: Boolean, parameter: OudsColorKeyToken.Surface) = OudsPreview(darkThemeEnabled = darkThemeEnabled) {
OudsContrastedSurface(color = parameter) {
internal fun PreviewOudsColoredSurface(darkThemeEnabled: Boolean, parameter: OudsColorKeyToken.Surface) = OudsPreview(darkThemeEnabled = darkThemeEnabled) {
OudsColoredSurface(color = parameter) {
Text(
modifier = Modifier.padding(all = OudsSpaceKeyToken.Fixed.Medium.value),
text = parameter.name.removePrefix("OudsColorKeyToken."),
)
}
}

internal class OudsContrastedSurfacePreviewParameterProvider : BasicPreviewParameterProvider<OudsColorKeyToken.Surface>(*previewParameterValues.toTypedArray())
internal class OudsColoredSurfacePreviewParameterProvider : BasicPreviewParameterProvider<OudsColorKeyToken.Surface>(*previewParameterValues.toTypedArray())

private val previewParameterValues: List<OudsColorKeyToken.Surface>
get() = listOf(
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/com/orange/ouds/core/theme/OudsTheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private val LocalOpacities = staticCompositionLocalOf<OudsOpacities> { missingCo
private val LocalSizes = staticCompositionLocalOf<OudsSizes> { missingCompositionLocalError("LocalSizes") }
private val LocalSpaces = staticCompositionLocalOf<OudsSpaces> { missingCompositionLocalError("LocalSpaces") }
private val LocalComponentsTokens = staticCompositionLocalOf<OudsComponentsTokens> { missingCompositionLocalError("LocalComponentsTokens") }
internal val LocalContrastedSurface = staticCompositionLocalOf<OudsColorKeyToken.Surface?> { null }
internal val LocalColoredSurface = staticCompositionLocalOf<OudsColorKeyToken.Surface?> { null }

object OudsTheme {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Software description: Android library of reusable graphical components
*/

package com.orange.ouds.core.component.contrastedsurface
package com.orange.ouds.core.component.coloredsurface

import app.cash.paparazzi.Paparazzi
import com.android.ide.common.rendering.api.SessionParams
Expand All @@ -21,31 +21,31 @@ import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
internal class OudsContrastedSurfaceTest(private val parameter: OudsColorKeyToken.Surface) {
internal class OudsColoredSurfaceTest(private val parameter: OudsColorKeyToken.Surface) {

companion object {
@JvmStatic
@Parameterized.Parameters
internal fun data() = OudsContrastedSurfacePreviewParameterProvider().values.toList()
internal fun data() = OudsColoredSurfacePreviewParameterProvider().values.toList()
}

@get:Rule
val paparazzi = Paparazzi(renderingMode = SessionParams.RenderingMode.SHRINK, maxPercentDifference = 0.0)

@Test
fun takeOudsContrastedSurfaceLightThemeSnapshot() {
fun takeOudsColoredSurfaceLightThemeSnapshot() {
paparazzi.snapshot {
PreviewOudsContrastedSurface(
PreviewOudsColoredSurface(
darkThemeEnabled = false,
parameter = parameter
)
}
}

@Test
fun takeOudsContrastedSurfaceDarkThemeSnapshot() {
fun takeOudsColoredSurfaceDarkThemeSnapshot() {
paparazzi.snapshot {
PreviewOudsContrastedSurface(
PreviewOudsColoredSurface(
darkThemeEnabled = true,
parameter = parameter
)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 47b334c

Please sign in to comment.