Skip to content

Commit 19ccb1f

Browse files
Update badge's background color for PayAtLocation
1 parent 3eff029 commit 19ccb1f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/compose/BookingStatusTag.kt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package com.woocommerce.android.ui.bookings.compose
22

33
import androidx.compose.runtime.Composable
44
import androidx.compose.ui.Modifier
5+
import androidx.compose.ui.graphics.Color
56
import androidx.compose.ui.res.colorResource
67
import androidx.compose.ui.res.stringResource
78
import androidx.compose.ui.text.font.FontWeight
8-
import androidx.compose.ui.tooling.preview.Preview
99
import com.woocommerce.android.R
1010
import com.woocommerce.android.ui.compose.component.WCTag
11+
import com.woocommerce.android.ui.compose.preview.LightDarkThemePreviews
1112
import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground
1213

1314
@Composable
@@ -17,7 +18,7 @@ fun BookingStatusTag(
1718
) {
1819
WCTag(
1920
text = state.text(),
20-
backgroundColor = colorResource(R.color.tagView_bg),
21+
backgroundColor = state.backgroundColor(),
2122
textColor = colorResource(R.color.tagView_text),
2223
fontWeight = FontWeight.Normal,
2324
modifier = modifier
@@ -49,7 +50,15 @@ private fun BookingStatus.text(): String {
4950
}
5051
}
5152

52-
@Preview
53+
@Composable
54+
fun BookingStatus.backgroundColor(): Color {
55+
return when (this) {
56+
BookingStatus.PayAtLocation -> R.color.tag_bg_booking_yellow
57+
else -> R.color.tagView_bg
58+
}.let { colorResource(it) }
59+
}
60+
61+
@LightDarkThemePreviews
5362
@Composable
5463
private fun PaymentStatusTagPreview() {
5564
WooThemeWithBackground {
@@ -59,12 +68,12 @@ private fun PaymentStatusTagPreview() {
5968
}
6069
}
6170

62-
@Preview(uiMode = android.content.res.Configuration.UI_MODE_NIGHT_YES)
71+
@LightDarkThemePreviews
6372
@Composable
64-
private fun PaymentStatusTagDarkPreview() {
73+
private fun PaymentStatusTagPayAtLocationPreview() {
6574
WooThemeWithBackground {
6675
BookingStatusTag(
67-
state = BookingStatus.Complete
76+
state = BookingStatus.PayAtLocation
6877
)
6978
}
7079
}

0 commit comments

Comments
 (0)