Skip to content

Commit

Permalink
fix: tertiary selected button color [WPB-15120] (#3757)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas authored Dec 20, 2024
1 parent 8792a6c commit df5ef14
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 28 deletions.
33 changes: 27 additions & 6 deletions app/src/main/kotlin/com/wire/android/ui/home/HomeTopBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ fun HomeTopBar(
}
if (navigationItem.withUserAvatar) {
val openLabel = stringResource(R.string.content_description_open_label)
val contentDescription = if (shouldShowCreateTeamUnreadIndicator) {
stringResource(R.string.content_description_home_profile_btn_with_notification)
} else {
stringResource(R.string.content_description_home_profile_btn)
}
val contentDescription = if (shouldShowCreateTeamUnreadIndicator) {
stringResource(R.string.content_description_home_profile_btn_with_notification)
} else {
stringResource(R.string.content_description_home_profile_btn)
}
UserProfileAvatar(
avatarData = userAvatarData,
clickable = remember {
Expand All @@ -87,7 +87,7 @@ fun HomeTopBar(
legalHoldIndicatorVisible = withLegalHoldIndicator
),
shouldShowCreateTeamUnreadIndicator = shouldShowCreateTeamUnreadIndicator,
contentDescription = contentDescription
contentDescription = contentDescription
)
}
},
Expand All @@ -112,6 +112,27 @@ fun PreviewTopBar() {
}
}

@PreviewMultipleThemes
@Composable
fun PreviewTopBarWithSelectedFilter() {
WireTheme {
HomeTopBar(
navigationItem = HomeDestination.Group,
userAvatarData = UserAvatarData(
asset = null,
availabilityStatus = UserAvailabilityStatus.AVAILABLE,
nameBasedAvatar = NameBasedAvatar("Jon Doe", -1)
),
elevation = 0.dp,
withLegalHoldIndicator = false,
shouldShowCreateTeamUnreadIndicator = false,
onHamburgerMenuClick = {},
onNavigateToSelfUserProfile = {},
onOpenConversationFilter = {}
)
}
}

@PreviewMultipleThemes
@Composable
fun PreviewSettingsTopBarWithoutAvatar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import com.wire.android.model.ClickBlockParams
import com.wire.android.ui.common.Icon
import com.wire.android.ui.theme.WireTheme
import com.wire.android.ui.theme.wireDimensions
import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.PreviewMultipleThemes

@Composable
fun WireTertiaryButton(
Expand Down Expand Up @@ -93,15 +94,15 @@ fun WireTertiaryButton(
description = description
)

@Preview(name = "Default WireSecondaryButton")
@PreviewMultipleThemes
@Composable
fun PreviewWireTertiaryButton() {
fun PreviewWireTertiaryButton() = WireTheme {
WireTertiaryButton(onClick = { }, text = "text")
}

@Preview(name = "Default narrow WireTertiaryButton with icon")
@PreviewMultipleThemes
@Composable
fun PreviewWireTertiaryButtonNarrowWithIcons() {
fun PreviewWireTertiaryButtonNarrowWithIcons() = WireTheme {
WireTertiaryButton(
onClick = { },
text = "text",
Expand All @@ -111,9 +112,9 @@ fun PreviewWireTertiaryButtonNarrowWithIcons() {
)
}

@Preview(name = "Default narrow WireTertiaryButton only icon")
@PreviewMultipleThemes
@Composable
fun PreviewWireTertiaryButtonNarrowOnlyIcons() {
fun PreviewWireTertiaryButtonNarrowOnlyIcons() = WireTheme {
WireTertiaryButton(
onClick = { },
leadingIcon = Icons.Filled.Search.Icon(),
Expand All @@ -122,20 +123,20 @@ fun PreviewWireTertiaryButtonNarrowOnlyIcons() {
)
}

@Preview(name = "Default narrow Disabled WireSecondaryButton")
@PreviewMultipleThemes
@Composable
fun PreviewWireTertiaryButtonDisabled() {
fun PreviewWireTertiaryButtonDisabled() = WireTheme {
WireTertiaryButton(onClick = { }, state = WireButtonState.Disabled, text = "text", fillMaxWidth = false)
}

@Preview(name = "Selected narrow WireSecondaryButton")
@PreviewMultipleThemes
@Composable
fun PreviewWireTertiaryButtonSelected() {
fun PreviewWireTertiaryButtonSelected() = WireTheme {
WireTertiaryButton(onClick = { }, state = WireButtonState.Selected, text = "text", fillMaxWidth = false)
}

@Preview(name = "Error narrow WireSecondaryButton")
@PreviewMultipleThemes
@Composable
fun PreviewWireTertiaryButtonError() {
fun PreviewWireTertiaryButtonError() = WireTheme {
WireTertiaryButton(onClick = { }, state = WireButtonState.Error, text = "text", fillMaxWidth = false)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import com.wire.android.model.ClickBlockParams
import com.wire.android.ui.common.R
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.common.preview.MultipleThemePreviews
import com.wire.android.ui.theme.WireTheme
import com.wire.android.ui.theme.wireDimensions

@Composable
Expand Down Expand Up @@ -78,21 +79,57 @@ fun WireTertiaryIconButton(
)
}

@Preview
@MultipleThemePreviews
@Composable
fun PreviewWireTertiaryIconButton() {
fun PreviewWireTertiaryIconButton() = WireTheme {
WireTertiaryIconButton({}, loading = false, iconResource = R.drawable.ic_close, contentDescription = 0)
}

@Preview
@MultipleThemePreviews
@Composable
fun PreviewWireTertiaryIconButtonLoading() {
fun PreviewWireTertiaryIconButtonSelected() = WireTheme {
WireTertiaryIconButton(
{},
loading = false,
iconResource = R.drawable.ic_close,
contentDescription = 0,
state = WireButtonState.Selected,
)
}

@MultipleThemePreviews
@Composable
fun PreviewWireTertiaryIconButtonError() = WireTheme {
WireTertiaryIconButton(
{},
loading = false,
iconResource = R.drawable.ic_close,
contentDescription = 0,
state = WireButtonState.Error,
)
}

@MultipleThemePreviews
@Composable
fun PreviewWireTertiaryIconButtonDisabled() = WireTheme {
WireTertiaryIconButton(
{},
loading = false,
iconResource = R.drawable.ic_close,
contentDescription = 0,
state = WireButtonState.Disabled,
)
}

@MultipleThemePreviews
@Composable
fun PreviewWireTertiaryIconButtonLoading() = WireTheme {
WireTertiaryIconButton({}, loading = true, iconResource = R.drawable.ic_close, contentDescription = 0)
}

@Preview
@MultipleThemePreviews
@Composable
fun PreviewWireTertiaryIconButtonRound() {
fun PreviewWireTertiaryIconButtonRound() = WireTheme {
WireTertiaryIconButton(
{},
loading = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ private val DarkWireColorScheme = WireColorScheme(
secondaryButtonRipple = Color.White,
tertiaryButtonEnabled = Color.Transparent, onTertiaryButtonEnabled = Color.White,
tertiaryButtonDisabled = Color.Transparent, onTertiaryButtonDisabled = WireColorPalette.Gray60,
tertiaryButtonSelected = WireColorPalette.DarkBlue50, onTertiaryButtonSelected = WireColorPalette.DarkBlue500,
tertiaryButtonSelectedOutline = WireColorPalette.DarkBlue300,
tertiaryButtonSelected = WireColorPalette.DarkBlue800, onTertiaryButtonSelected = WireColorPalette.DarkBlue500,
tertiaryButtonSelectedOutline = WireColorPalette.DarkBlue800,
tertiaryButtonRipple = Color.White,

// strokes and shadows
Expand Down

0 comments on commit df5ef14

Please sign in to comment.