Skip to content
Open
Show file tree
Hide file tree
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 @@ -83,8 +83,8 @@ fun Header(
textAlign: TextAlign,
fontSize: TextUnit
) {
if (text == null && resourceId == null) {
throw IllegalArgumentException("No text or resourceId passed to Header component")
require(text != null || resourceId != null) {
"No text or resourceId passed to Header component"
}
Text(
text = text ?: stringResource(id = resourceId!!),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package com.shopify.checkoutkit.androiddemo.products.product

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.TextButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.OutlinedButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.shopify.checkoutkit.androiddemo.R
import com.shopify.checkoutkit.androiddemo.common.components.Header3

Expand All @@ -23,21 +21,23 @@ fun AddToCartButton(
modifier: Modifier,
onClick: () -> Unit
) {
val buttonEnabled = enabled && !loading

Column(
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally,
) {
TextButton(
OutlinedButton(
modifier = Modifier.fillMaxWidth(),
enabled = !loading,
enabled = buttonEnabled,
onClick = onClick,
border = BorderStroke(1.dp, MaterialTheme.colorScheme.onBackground),
shape = RectangleShape
shape = RectangleShape,
) {
Box {
Header3(
textAlign = TextAlign.Center,
text = stringResource(id = R.string.product_add_to_cart),
color = LocalContentColor.current,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ style:
ThrowsCount:
active: false
UnusedParameter:
active: false
active: true
UseRequire:
active: false
active: true

formatting:
active: true
Expand Down
Loading