11package com.cornellappdev.uplift.ui.components.general
22
33import androidx.compose.animation.core.animateFloatAsState
4+ import androidx.compose.foundation.layout.Arrangement
5+ import androidx.compose.foundation.layout.Row
6+ import androidx.compose.foundation.layout.Spacer
7+ import androidx.compose.foundation.layout.defaultMinSize
48import androidx.compose.foundation.layout.height
59import androidx.compose.foundation.layout.width
610import androidx.compose.foundation.layout.wrapContentSize
@@ -11,6 +15,7 @@ import androidx.compose.material3.Surface
1115import androidx.compose.material3.Text
1216import androidx.compose.runtime.Composable
1317import androidx.compose.runtime.getValue
18+ import androidx.compose.ui.Alignment
1419import androidx.compose.ui.Modifier
1520import androidx.compose.ui.draw.alpha
1621import androidx.compose.ui.graphics.Color
@@ -46,7 +51,9 @@ fun UpliftButton(
4651 disabledContainerColor : Color = GRAY02 ,
4752 contentColor : Color = PRIMARY_BLACK ,
4853 disabledContentColor : Color = PRIMARY_BLACK ,
49- elevation : Dp = 4.dp
54+ elevation : Dp = 4.dp,
55+ leadingIcon : (@Composable () -> Unit )? = null,
56+ modifier : Modifier = Modifier
5057) {
5158 val enabledAlpha by animateFloatAsState(
5259 targetValue = if (enabled) 1f else 0.5f ,
@@ -60,8 +67,8 @@ fun UpliftButton(
6067 disabledContentColor = disabledContentColor
6168 ),
6269 shape = RoundedCornerShape (38 .dp),
63- modifier = Modifier
64- .width( width)
70+ modifier = modifier
71+ .defaultMinSize(minWidth = width)
6572 .height(height)
6673 .alpha(enabledAlpha),
6774 elevation = ButtonDefaults .buttonElevation(
@@ -70,15 +77,23 @@ fun UpliftButton(
7077 onClick = { onClick() },
7178 enabled = enabled,
7279 ) {
73- Text (
74- text = text,
75- color = PRIMARY_BLACK ,
76- fontFamily = montserratFamily,
77- fontSize = fontSize.sp,
78- fontWeight = FontWeight .Bold ,
79- textAlign = TextAlign .Center ,
80- modifier = Modifier .wrapContentSize()
81- )
80+ Row (
81+ verticalAlignment = Alignment .CenterVertically ,
82+ horizontalArrangement = Arrangement .Center
83+ ) {
84+ leadingIcon?.let {
85+ it()
86+ }
87+ Text (
88+ text = text,
89+ color = contentColor,
90+ fontFamily = montserratFamily,
91+ fontSize = fontSize.sp,
92+ fontWeight = FontWeight .Bold ,
93+ textAlign = TextAlign .Center ,
94+ modifier = modifier.wrapContentSize()
95+ )
96+ }
8297 }
8398}
8499
0 commit comments