Skip to content

Commit

Permalink
Fix link display after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
paulinea committed Dec 19, 2024
1 parent 4d90724 commit 7210e3d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
31 changes: 17 additions & 14 deletions core/src/main/java/com/orange/ouds/core/component/link/OudsLink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.Dp
Expand Down Expand Up @@ -254,8 +252,8 @@ private fun Modifier.border(state: OudsLink.State): Modifier {
width = OudsBorderKeyToken.Width.Focus.value,
color = OudsColorKeyToken.Border.Focus.value,
shape = RectangleShape,
insetWidth = OudsBorderKeyToken.Width.Focus.Inset.value,
insetColor = OudsColorKeyToken.Border.Focus.Inset.value
insetWidth = OudsBorderKeyToken.Width.FocusInset.value,
insetColor = OudsColorKeyToken.Border.FocusInset.value
)
} else {
this
Expand All @@ -266,18 +264,23 @@ private fun Modifier.border(state: OudsLink.State): Modifier {
private fun buttonColors(linkState: OudsLink.State, onColoredBackground: Boolean): ButtonColors {
with(OudsTheme.componentsTokens.link) {
return ButtonDefaults.buttonColors(
containerColor = if (linkState == OudsLink.State.Skeleton) {
OudsColorKeyToken.Gradient.Skeleton.StartEnd
} else {
OudsColorKeyToken.Transparent.Default
}.value,
containerColor = containerColor(state = linkState),
contentColor = contentColor(state = linkState, onColoredBackground = onColoredBackground),
disabledContainerColor = OudsColorKeyToken.Transparent.Default.value,
disabledContentColor = if (onColoredBackground) OudsColorKeyToken.Action.Disabled.value else colorContentDisabledMono.value
disabledContainerColor = containerColor(state = linkState),
disabledContentColor = contentColor(state = linkState, onColoredBackground = onColoredBackground)
)
}
}

@Composable
private fun containerColor(state: OudsLink.State): Color {
return if (state == OudsLink.State.Skeleton) {
OudsTheme.componentsTokens.skeleton.colorBg
} else {
OudsColorKeyToken.Opacity.Transparent
}.value
}


@Composable
private fun contentColor(state: OudsLink.State, onColoredBackground: Boolean): Color {
Expand All @@ -289,7 +292,7 @@ private fun contentColor(state: OudsLink.State, onColoredBackground: Boolean): C
OudsLink.State.Hovered -> colorContentHoverMono
OudsLink.State.Pressed -> colorContentPressedMono
OudsLink.State.Disabled -> colorContentDisabledMono
OudsLink.State.Skeleton -> OudsColorKeyToken.Transparent.Default
OudsLink.State.Skeleton -> OudsColorKeyToken.Opacity.Transparent
}
} else {
when (state) {
Expand All @@ -298,7 +301,7 @@ private fun contentColor(state: OudsLink.State, onColoredBackground: Boolean): C
OudsLink.State.Hovered -> colorContentHover
OudsLink.State.Pressed -> colorContentPressed
OudsLink.State.Disabled -> OudsColorKeyToken.Action.Disabled
OudsLink.State.Skeleton -> OudsColorKeyToken.Transparent.Default
OudsLink.State.Skeleton -> OudsColorKeyToken.Opacity.Transparent
}
}
}.value
Expand All @@ -316,7 +319,7 @@ private fun arrowColor(state: OudsLink.State, onColoredBackground: Boolean): Col
OudsLink.State.Hovered -> colorArrowHover
OudsLink.State.Pressed -> colorArrowPressed
OudsLink.State.Disabled -> OudsColorKeyToken.Action.Disabled
OudsLink.State.Skeleton -> OudsColorKeyToken.Transparent.Default
OudsLink.State.Skeleton -> OudsColorKeyToken.Opacity.Transparent
}.value
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ package com.orange.ouds.theme.tokens.components

class OudsComponentsTokens(
val button: OudsButtonTokens = OudsButtonTokens(),
val skeleton: OudsSkeletonTokens = OudsSkeletonTokens()
val skeleton: OudsSkeletonTokens = OudsSkeletonTokens(),
val link: OudsLinkTokens = OudsLinkTokens(),
)

0 comments on commit 7210e3d

Please sign in to comment.