Remove launch icon and update BitwardenActionCard (#4097)

This commit is contained in:
David Perez 2024-10-15 14:41:19 -05:00 committed by GitHub
parent ec47cb9ee2
commit 736912bd6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 40 deletions

View file

@ -4,12 +4,10 @@ import android.content.res.Configuration
import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.material3.Card import androidx.compose.material3.Card
@ -28,6 +26,7 @@ import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconBu
import com.x8bit.bitwarden.ui.platform.components.card.color.bitwardenCardColors import com.x8bit.bitwarden.ui.platform.components.card.color.bitwardenCardColors
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter
import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
import kotlin.let
/** /**
* A design component action card, which contains a title, action button, and a dismiss button * A design component action card, which contains a title, action button, and a dismiss button
@ -57,12 +56,9 @@ fun BitwardenActionCard(
elevation = CardDefaults.elevatedCardElevation(), elevation = CardDefaults.elevatedCardElevation(),
border = BorderStroke(width = 1.dp, color = BitwardenTheme.colorScheme.stroke.border), border = BorderStroke(width = 1.dp, color = BitwardenTheme.colorScheme.stroke.border),
) { ) {
Column( Row(modifier = Modifier.fillMaxWidth()) {
modifier = Modifier.padding(16.dp), Spacer(Modifier.width(16.dp))
) { Row(modifier = Modifier.padding(top = 16.dp)) {
Row(
modifier = Modifier.fillMaxWidth(),
) {
leadingContent?.let { leadingContent?.let {
it() it()
Spacer(Modifier.width(12.dp)) Spacer(Modifier.width(12.dp))
@ -71,28 +67,33 @@ fun BitwardenActionCard(
text = cardTitle, text = cardTitle,
style = BitwardenTheme.typography.titleMedium, style = BitwardenTheme.typography.titleMedium,
) )
Spacer(Modifier.weight(1f))
BitwardenStandardIconButton(
painter = rememberVectorPainter(id = R.drawable.ic_close),
contentDescription = stringResource(id = R.string.close),
onClick = onDismissClick,
modifier = Modifier.offset(x = 10.dp, y = (-10).dp),
)
} }
cardSubtitle?.let { Spacer(Modifier.weight(1f))
Spacer(Modifier.height(4.dp)) BitwardenStandardIconButton(
Text( painter = rememberVectorPainter(id = R.drawable.ic_close),
text = it, contentDescription = stringResource(id = R.string.close),
style = BitwardenTheme.typography.bodyMedium, onClick = onDismissClick,
)
}
Spacer(Modifier.height(16.dp))
BitwardenFilledButton(
label = actionText,
onClick = onActionClick,
modifier = Modifier.fillMaxWidth(),
) )
} }
cardSubtitle?.let {
Spacer(Modifier.height(4.dp))
Text(
text = it,
style = BitwardenTheme.typography.bodyMedium,
modifier = Modifier
.padding(horizontal = 16.dp)
.fillMaxWidth(),
)
}
Spacer(Modifier.height(16.dp))
BitwardenFilledButton(
label = actionText,
onClick = onActionClick,
modifier = Modifier
.padding(horizontal = 16.dp)
.fillMaxWidth(),
)
Spacer(Modifier.height(16.dp))
} }
} }

View file

@ -418,7 +418,7 @@ private fun UriField(
actions = { actions = {
if (uriData.isLaunchable) { if (uriData.isLaunchable) {
BitwardenFilledIconButton( BitwardenFilledIconButton(
vectorIconRes = R.drawable.ic_launch, vectorIconRes = R.drawable.ic_external_link,
contentDescription = stringResource(id = R.string.launch), contentDescription = stringResource(id = R.string.launch),
onClick = { onLaunchUriClick(uriData.uri) }, onClick = { onLaunchUriClick(uriData.uri) },
modifier = Modifier.testTag(tag = "LoginLaunchUriButton"), modifier = Modifier.testTag(tag = "LoginLaunchUriButton"),

View file

@ -1,12 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportHeight="20"
android:viewportWidth="20">
<path
android:fillColor="#151B2C"
android:pathData="M15.891,0.076C15.584,-0.08 15.207,0.042 15.051,0.35C14.895,0.658 15.017,1.034 15.325,1.19L17.774,2.435C14.277,3.029 12.043,4.708 10.689,6.613C9.317,8.545 8.87,10.682 8.885,12.092C8.888,12.437 9.171,12.714 9.516,12.71C9.861,12.706 10.138,12.424 10.135,12.078C10.122,10.904 10.504,9.031 11.708,7.337C12.898,5.662 14.909,4.131 18.224,3.629C18.249,3.625 18.274,3.62 18.298,3.613L17.065,6.248C16.919,6.561 17.054,6.933 17.367,7.079C17.679,7.225 18.051,7.09 18.198,6.778L19.903,3.132C20.117,2.674 19.929,2.128 19.478,1.899L15.891,0.076Z" />
<path
android:fillColor="#151B2C"
android:pathData="M10,1.25H3.125C2.089,1.25 1.25,2.089 1.25,3.125V16.875C1.25,17.91 2.089,18.75 3.125,18.75H16.875C17.91,18.75 18.75,17.91 18.75,16.875V10C18.75,9.655 18.47,9.375 18.125,9.375C17.78,9.375 17.5,9.655 17.5,10V16.875C17.5,17.22 17.22,17.5 16.875,17.5H3.125C2.78,17.5 2.5,17.22 2.5,16.875V3.125C2.5,2.78 2.78,2.5 3.125,2.5H10C10.345,2.5 10.625,2.22 10.625,1.875C10.625,1.53 10.345,1.25 10,1.25Z" />
</vector>