Skip to content

Commit 5ed8edd

Browse files
committed
Abstracted EmptyState
1 parent bd7b7fa commit 5ed8edd

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

app/src/main/java/com/cornellappdev/score/components/EmptyState.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.cornellappdev.score.theme.Style.heading2
2424
@Composable
2525
fun EmptyState(
2626
modifier: Modifier = Modifier,
27+
icon: Int = R.drawable.ic_speaker_gray,
2728
title: String = "No games yet.",
2829
subtitle: String = "Check back here later!"
2930
) {
@@ -33,7 +34,7 @@ fun EmptyState(
3334
verticalArrangement = Arrangement.Center
3435
) {
3536
Image(
36-
painter = painterResource(R.drawable.ic_speaker_gray),
37+
painter = painterResource(icon),
3738
contentDescription = "score speaker icon"
3839
)
3940
Spacer(modifier = Modifier.height(16.dp))
@@ -53,6 +54,7 @@ fun EmptyState(
5354
fun EmptyStateBox(
5455
modifier: Modifier = Modifier,
5556
height: Dp = 550.dp,
57+
icon: Int = R.drawable.ic_speaker_gray,
5658
title: String = "No games yet.",
5759
subtitle: String = "Check back here later!"
5860
) {
@@ -61,7 +63,7 @@ fun EmptyStateBox(
6163
.height(height)
6264
.fillMaxWidth(), contentAlignment = Alignment.Center
6365
) {
64-
EmptyState(title = title, subtitle = subtitle)
66+
EmptyState(icon = icon, title = title, subtitle = subtitle)
6567
}
6668
}
6769

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="96dp"
3+
android:height="96dp"
4+
android:viewportWidth="96"
5+
android:viewportHeight="96">
6+
<group>
7+
<clip-path
8+
android:pathData="M0,0h96v96h-96z"/>
9+
<path
10+
android:pathData="M31.586,27.145L42.654,12.603C43.343,11.697 44.15,11.03 45.075,10.601C46,10.173 46.976,9.959 48.005,9.959C49.034,9.959 50.009,10.173 50.929,10.601C51.85,11.03 52.655,11.697 53.346,12.603L64.414,27.145L81.336,32.867C82.816,33.358 83.967,34.207 84.788,35.416C85.609,36.625 86.02,37.961 86.02,39.424C86.02,40.099 85.922,40.774 85.725,41.451C85.528,42.128 85.205,42.765 84.756,43.362L73.797,58.637L74.197,74.954C74.236,76.917 73.58,78.582 72.229,79.949C70.877,81.316 69.276,82 67.425,82C67.374,82 66.749,81.913 65.549,81.738L48,76.708L30.462,81.734C30.121,81.87 29.781,81.948 29.442,81.969C29.103,81.99 28.792,82 28.509,82C26.638,82 25.036,81.314 23.703,79.943C22.37,78.572 21.736,76.886 21.803,74.887L22.203,58.534L11.239,43.321C10.808,42.7 10.493,42.052 10.296,41.377C10.099,40.702 10,40.026 10,39.351C10,37.914 10.413,36.59 11.239,35.379C12.064,34.168 13.219,33.317 14.703,32.828L31.586,27.145ZM34.679,31.477L15.651,37.867C15.266,37.995 15.004,38.258 14.863,38.655C14.722,39.052 14.779,39.418 15.036,39.751L27.308,57.1L26.828,75.754C26.803,76.19 26.957,76.532 27.29,76.779C27.623,77.027 27.995,77.096 28.405,76.985L48,71.459L67.595,77.085C68.005,77.196 68.377,77.127 68.71,76.879C69.043,76.632 69.197,76.29 69.172,75.854L68.692,57.1L80.964,39.951C81.221,39.618 81.278,39.252 81.137,38.855C80.996,38.458 80.734,38.195 80.349,38.067L61.321,31.477L48.962,15.226C48.731,14.893 48.41,14.726 48,14.726C47.59,14.726 47.269,14.893 47.038,15.226L34.679,31.477Z"
11+
android:fillColor="#C2C2C2"/>
12+
</group>
13+
</vector>

0 commit comments

Comments
 (0)