Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement button style updates #7508

Merged
merged 2 commits into from
May 31, 2024
Merged
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 @@ -2,7 +2,6 @@ package io.horizontalsystems.bankwallet.ui.compose.components

import androidx.annotation.DrawableRes
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -18,9 +17,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.intl.Locale
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.toUpperCase
import androidx.compose.ui.unit.dp
import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme
import io.horizontalsystems.bankwallet.ui.compose.TranslatableString
Expand Down Expand Up @@ -187,16 +184,14 @@ private fun MenuItemSimple(menuItem: MenuItem) {
showAlertDot = menuItem.showAlertDot,
)
} else {
Text(
modifier = Modifier
.padding(horizontal = 16.dp)
.clickable(
enabled = menuItem.enabled,
onClick = menuItem.onClick
),
text = menuItem.title.getString().toUpperCase(Locale.current),
style = ComposeAppTheme.typography.headline2,
color = color
)
ButtonPrimaryWrapper(
enabled = menuItem.enabled,
onClick = menuItem.onClick
){
Text(
text = menuItem.title.getString().uppercase(),
color = color
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
Expand All @@ -25,6 +26,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.res.painterResource
Expand Down Expand Up @@ -279,6 +281,36 @@ fun ButtonPrimaryYellowWithSpinner(
)
}

@Composable
fun ButtonPrimaryWrapper(
modifier: Modifier = Modifier,
enabled: Boolean = true,
onClick: () -> Unit,
content: @Composable () -> Unit
) {
ProvideTextStyle(
value = ComposeAppTheme.typography.headline2
) {
Box(
modifier = modifier
.clip(RoundedCornerShape(25.dp))
.defaultMinSize(
minWidth = ButtonPrimaryDefaults.MinWidth,
minHeight = ButtonPrimaryDefaults.MinHeight
)
.clickable(
enabled = enabled,
onClick = onClick,
)
.padding(ButtonPrimaryDefaults.ContentPadding),
contentAlignment = Alignment.Center,
) {
content()
}
}
}


@OptIn(ExperimentalMaterialApi::class)
@Composable
fun ButtonPrimary(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ fun ButtonSecondaryDefault(
onClick = onClick,
content = {
if (enabled) {
subhead1_leah(text = title, maxLines = 1)
captionSB_leah(text = title, maxLines = 1)
} else {
subhead1_grey50(text = title, maxLines = 1)
captionSB_grey50(text = title, maxLines = 1)
}
},
enabled = enabled
Expand All @@ -79,6 +79,7 @@ fun ButtonSecondaryYellow(
Text(
title,
maxLines = 1,
style = ComposeAppTheme.typography.captionSB,
overflow = TextOverflow.Ellipsis,
)
},
Expand All @@ -99,19 +100,19 @@ fun ButtonSecondaryWithIcon(
onClick = onClick,
contentPadding = PaddingValues(
start = 16.dp,
end = 12.dp,
end = 8.dp,
),
content = {
Row(
verticalAlignment = Alignment.CenterVertically
) {
subhead1_leah(
captionSB_leah(
text = title,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Icon(
modifier = Modifier.padding(start = 4.dp),
modifier = Modifier.padding(start = 2.dp),
painter = iconRight,
contentDescription = null,
tint = ComposeAppTheme.colors.grey
Expand Down Expand Up @@ -146,6 +147,7 @@ fun ButtonSecondaryTransparent(
Text(
title,
maxLines = 1,
style = ComposeAppTheme.typography.captionSB,
overflow = TextOverflow.Ellipsis,
)
Icon(
Expand Down Expand Up @@ -184,7 +186,12 @@ fun <T : WithTranslatableTitle> ButtonSecondaryToggle(
modifier = Modifier.height(IntrinsicSize.Max),
verticalAlignment = Alignment.CenterVertically
) {
Text(select.selected.title.getString(), maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(
text = select.selected.title.getString(),
maxLines = 1,
style = ComposeAppTheme.typography.captionSB,
overflow = TextOverflow.Ellipsis
)
Column(
modifier = Modifier
.height(16.dp)
Expand Down
Loading