Skip to content

Commit 1697e1d

Browse files
authored
Merge pull request #13569 from woocommerce/feature-branch-woopos-design-system
[Woo POS][Design System] Feature branch
2 parents 79f229e + b2fea25 commit 1697e1d

File tree

56 files changed

+2048
-1347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2048
-1347
lines changed

WooCommerce/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ dependencies {
217217
implementation(libs.androidx.recyclerview.selection)
218218
implementation(libs.androidx.appcompat)
219219
implementation(libs.google.material)
220+
implementation(libs.google.compose.material3)
220221
implementation(libs.androidx.transition)
221222
implementation(libs.androidx.cardview)
222223
implementation(libs.androidx.browser) {

WooCommerce/src/androidTest/kotlin/com/woocommerce/android/WooPosErrorScreenTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import androidx.compose.ui.test.junit4.createComposeRule
55
import androidx.compose.ui.test.onNodeWithText
66
import androidx.compose.ui.test.performClick
77
import androidx.test.ext.junit.runners.AndroidJUnit4
8-
import com.woocommerce.android.ui.woopos.common.composeui.WooPosTheme
98
import com.woocommerce.android.ui.woopos.common.composeui.component.Button
109
import com.woocommerce.android.ui.woopos.common.composeui.component.WooPosErrorScreen
10+
import com.woocommerce.android.ui.woopos.common.composeui.designsystem.WooPosTheme
1111
import dagger.hilt.android.testing.HiltAndroidRule
1212
import dagger.hilt.android.testing.HiltAndroidTest
1313
import org.junit.Before

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cashpayment/WooPosCashPaymentScreen.kt

+19-18
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ package com.woocommerce.android.ui.woopos.cashpayment
33
import androidx.compose.foundation.layout.Column
44
import androidx.compose.foundation.layout.fillMaxSize
55
import androidx.compose.foundation.text.KeyboardOptions
6-
import androidx.compose.material.MaterialTheme
7-
import androidx.compose.material.Text
6+
import androidx.compose.material3.MaterialTheme
87
import androidx.compose.runtime.Composable
98
import androidx.compose.runtime.LaunchedEffect
109
import androidx.compose.runtime.collectAsState
@@ -17,7 +16,6 @@ import androidx.compose.ui.focus.FocusRequester
1716
import androidx.compose.ui.focus.focusRequester
1817
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
1918
import androidx.compose.ui.res.stringResource
20-
import androidx.compose.ui.text.font.FontWeight
2119
import androidx.compose.ui.text.input.KeyboardType
2220
import androidx.compose.ui.text.style.TextAlign
2321
import androidx.compose.ui.unit.dp
@@ -26,12 +24,15 @@ import androidx.constraintlayout.compose.Dimension
2624
import androidx.hilt.navigation.compose.hiltViewModel
2725
import com.woocommerce.android.R
2826
import com.woocommerce.android.ui.woopos.common.composeui.WooPosPreview
29-
import com.woocommerce.android.ui.woopos.common.composeui.WooPosTheme
3027
import com.woocommerce.android.ui.woopos.common.composeui.component.WooPosButton
3128
import com.woocommerce.android.ui.woopos.common.composeui.component.WooPosButtonState
3229
import com.woocommerce.android.ui.woopos.common.composeui.component.WooPosMoneyInputField
30+
import com.woocommerce.android.ui.woopos.common.composeui.component.WooPosText
3331
import com.woocommerce.android.ui.woopos.common.composeui.component.WooPosToolbar
34-
import com.woocommerce.android.ui.woopos.common.composeui.toAdaptivePadding
32+
import com.woocommerce.android.ui.woopos.common.composeui.designsystem.WooPosSpacing
33+
import com.woocommerce.android.ui.woopos.common.composeui.designsystem.WooPosTheme
34+
import com.woocommerce.android.ui.woopos.common.composeui.designsystem.WooPosTypography
35+
import com.woocommerce.android.ui.woopos.common.composeui.designsystem.toAdaptivePadding
3536
import com.woocommerce.android.ui.woopos.root.navigation.WooPosNavigationEvent
3637
import org.wordpress.android.fluxc.model.WCSettingsModel
3738
import java.math.BigDecimal
@@ -102,20 +103,20 @@ private fun Collecting(
102103
keyboardController?.show()
103104
}
104105

105-
Text(
106+
WooPosText(
106107
text = state.totalText,
107-
style = MaterialTheme.typography.h6,
108+
style = WooPosTypography.BodyLarge,
108109
modifier = Modifier
109110
.constrainAs(total) {
110-
top.linkTo(parent.top, margin = 4.dp)
111+
top.linkTo(parent.top, margin = WooPosSpacing.XSmall.value)
111112
start.linkTo(parent.start, margin = 64.dp)
112113
}
113114
)
114115

115116
var inputText by remember { mutableStateOf(state.enteredAmount) }
116117

117118
val marginBetweenTotalAndInput = 48.dp.toAdaptivePadding()
118-
val standardMargin = 16.dp.toAdaptivePadding()
119+
val standardMargin = WooPosSpacing.Medium.value.toAdaptivePadding()
119120
WooPosMoneyInputField(
120121
modifier = Modifier
121122
.focusRequester(focusRequester)
@@ -132,19 +133,19 @@ private fun Collecting(
132133
keyboardOptions = KeyboardOptions(
133134
keyboardType = KeyboardType.Decimal
134135
),
135-
textStyle = MaterialTheme.typography.h4,
136+
textStyle = WooPosTypography.Heading,
137+
textColor = MaterialTheme.colorScheme.onSurface,
136138
currencySymbol = state.currencySymbol,
137139
currencyPosition = state.currencyPosition,
138140
decimalSeparator = state.decimalSeparator,
139141
numberOfDecimals = state.numberOfDecimals,
140142
)
141143

142-
val smallMargin = 8.dp.toAdaptivePadding()
143-
Text(
144+
val smallMargin = WooPosSpacing.Small.value.toAdaptivePadding()
145+
WooPosText(
144146
text = state.changeDueText,
145-
style = MaterialTheme.typography.body1,
146-
color = MaterialTheme.colors.secondary,
147-
fontWeight = FontWeight.Normal,
147+
style = WooPosTypography.BodySmall,
148+
color = WooPosTheme.colors.onSurfaceVariantLowest,
148149
modifier = Modifier
149150
.constrainAs(changeDue) {
150151
top.linkTo(input.bottom, margin = smallMargin)
@@ -154,10 +155,10 @@ private fun Collecting(
154155
)
155156

156157
if (state.errorMessage != null) {
157-
Text(
158+
WooPosText(
158159
text = state.errorMessage,
159-
color = MaterialTheme.colors.error,
160-
style = MaterialTheme.typography.body1,
160+
color = MaterialTheme.colorScheme.error,
161+
style = WooPosTypography.BodySmall,
161162
textAlign = TextAlign.Center,
162163
modifier = Modifier.constrainAs(error) {
163164
top.linkTo(changeDue.bottom, margin = smallMargin)

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/common/composeui/WooPosTheme.kt

-233
This file was deleted.

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/common/composeui/component/WooPosBackgroundOverlay.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import androidx.compose.foundation.clickable
88
import androidx.compose.foundation.interaction.MutableInteractionSource
99
import androidx.compose.foundation.layout.Box
1010
import androidx.compose.foundation.layout.fillMaxSize
11-
import androidx.compose.material.MaterialTheme
11+
import androidx.compose.material3.MaterialTheme
1212
import androidx.compose.runtime.Composable
1313
import androidx.compose.runtime.remember
1414
import androidx.compose.ui.Modifier
@@ -27,7 +27,7 @@ fun WooPosBackgroundOverlay(
2727
Box(
2828
modifier = modifier
2929
.fillMaxSize()
30-
.background(color = MaterialTheme.colors.onSurface.copy(alpha = 0.2f))
30+
.background(color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.2f))
3131
.clickable(
3232
indication = null,
3333
interactionSource = remember { MutableInteractionSource() }

0 commit comments

Comments
 (0)