Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANDROID-13605 - Unify Ids Skeleton #288

Draft
wants to merge 1 commit into
base: feature_branch/unify_ids
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.telefonica.mistica.compose.theme.MisticaTheme
Expand All @@ -40,6 +41,7 @@ fun LineSkeleton(
val skeletonColor by skeletonColorTransition(infiniteTransition, style)
Box(
modifier = modifier
.testTag(SkeletonTestTags.SKELETON_LINE)
.fillMaxWidth()
.clip(shape = RoundedCornerShape(MisticaTheme.radius.containerBorderRadius))
.background(skeletonColor)
Expand All @@ -54,7 +56,9 @@ fun TextSkeleton(
style: SkeletonStyle = SkeletonStyle.Default,
) {
Column(
modifier = modifier.wrapContentHeight()
modifier = modifier
.testTag(SkeletonTestTags.SKELETON_TEXT)
.wrapContentHeight()
) {
LineSkeleton(
infiniteTransition = infiniteTransition,
Expand Down Expand Up @@ -87,6 +91,7 @@ fun CircleSkeleton(
val skeletonColor by skeletonColorTransition(infiniteTransition, style)
Box(
modifier = modifier
.testTag(SkeletonTestTags.SKELETON_CIRCLE)
.clip(shape = CircleShape)
.background(skeletonColor)
.size(40.dp)
Expand All @@ -102,6 +107,7 @@ fun RowSkeleton(
) {
Row(
modifier = modifier
.testTag(SkeletonTestTags.SKELETON_ROW)
.fillMaxWidth()
.wrapContentHeight(),
) {
Expand Down Expand Up @@ -129,6 +135,7 @@ fun RectangleSkeleton(
val skeletonColor by skeletonColorTransition(infiniteTransition, style)
Box(
modifier = modifier
.testTag(SkeletonTestTags.SKELETON_RECTANGLE)
.fillMaxWidth()
.clip(shape = RoundedCornerShape(MisticaTheme.radius.containerBorderRadius))
.background(skeletonColor)
Expand Down Expand Up @@ -191,4 +198,12 @@ fun SkeletonPreview() {
enum class SkeletonStyle {
Default,
Inverse,
}
}

object SkeletonTestTags {
const val SKELETON_LINE = "skeleton_line"
const val SKELETON_TEXT = "skeleton_text"
const val SKELETON_CIRCLE = "skeleton_circle"
const val SKELETON_ROW = "skeleton_row"
const val SKELETON_RECTANGLE = "skeleton_rectangle"
}
Loading