Skip to content

Commit

Permalink
replaced Text with Button composable
Browse files Browse the repository at this point in the history
  • Loading branch information
lalwani committed Jun 11, 2024
1 parent b04c67c commit 507d87d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
28 changes: 12 additions & 16 deletions core/src/main/kotlin/com/uber/sdk2/core/ui/UberButton.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,16 @@
*/
package com.uber.sdk2.core.ui

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.uber.sdk2.core.R

Expand All @@ -54,14 +49,15 @@ fun UberButton(text: String, isWhite: Boolean = false, onClick: () -> Unit) {
colorResource(id = R.color.uber_white)
}

Text(
text = text,
color = textColor,
style = TextStyle(fontSize = dimensionResource(id = R.dimen.ub__text_size).value.sp),
modifier =
Modifier.clip(RoundedCornerShape(4.dp))
.background(backgroundColor)
.clickable(interactionSource = interactionSource, indication = null, onClick = onClick)
.padding(16.dp),
Button(
onClick = onClick,
content = {
Text(
text = text,
color = textColor,
style = TextStyle(fontSize = dimensionResource(id = R.dimen.ub__text_size).value.sp),
)
},
colors = ButtonDefaults.buttonColors(containerColor = backgroundColor, contentColor = textColor),
)
}
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ include(
":core",
":core-android",
":rides-android",
":samples:auth-demo",
":samples:request-button-sample",
":samples:login-sample",
":samples:login-with-auth-code-demo",
Expand Down

0 comments on commit 507d87d

Please sign in to comment.