Skip to content

Commit

Permalink
dhonti/ANDROID-15405-postercard: Update modifier function in order to…
Browse files Browse the repository at this point in the history
… accept a clickable() and update param "contentDescription"
  • Loading branch information
dhonti-axpe committed Nov 25, 2024
1 parent e1fbfc4 commit 91ca854
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ fun PosterCard(
shape = RoundedCornerShape(MisticaTheme.radius.containerBorderRadius),
modifier = Modifier
.width(maxWidth)
.let { modifierValue ->
onClickAction?.let {
modifierValue.clickable { it.invoke() }
}
modifierValue.heightIn(
min = maxWidth / aspectRatio.ratio,
max = Dp.Infinity
)
.clickable(enabled = onClickAction != null) {
onClickAction?.invoke()
}
.heightIn(
min = maxWidth / aspectRatio.ratio,
max = Dp.Infinity
)
) {
PosterCardBackground(backgroundType = backgroundType) {
Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ internal fun TopAction(topActionData: TopActionData) {
.testTag(topActionData.testTag.orEmpty())
.size(40.dp)
.clip(CircleShape)
.clickable(enabled = topActionData.onClick != null) {
topActionData.onClick?.invoke()
}
.background(color = backgroundColor)
.wrapContentSize(align = Alignment.Center)
.let { modifierValue ->
topActionData.onClick?.let {
modifierValue.clickable { it() }
} ?: modifierValue
}

) {
Image(
painter = painterResource(id = iconRes),
Expand All @@ -72,8 +71,8 @@ internal fun TopAction(topActionData: TopActionData) {
data class TopActionData(
val iconRes: Int,
val backgroundColor: Color = Color.Transparent,
val contentDescription: String = "",
val iconTint: Color? = null,
val contentDescription: String? = null,
val testTag: String? = null,
val onClick: (() -> Unit)? = null,
)

0 comments on commit 91ca854

Please sign in to comment.