Skip to content

Commit

Permalink
Set daita chip to disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-mullvad committed Sep 3, 2024
1 parent 8a679ab commit f5072fe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fun ProviderFilterChip(providers: Int, onRemoveClick: () -> Unit) {
MullvadFilterChip(
text = stringResource(id = R.string.number_of_providers, providers),
onRemoveClick = onRemoveClick,
showIcon = true,
enabled = true,
)
}

Expand All @@ -77,7 +77,7 @@ fun OwnershipFilterChip(ownership: Ownership, onRemoveClick: () -> Unit) {
MullvadFilterChip(
text = stringResource(ownership.stringResources()),
onRemoveClick = onRemoveClick,
showIcon = true,
enabled = true,
)
}

Expand All @@ -86,7 +86,7 @@ fun DaitaFilterChip() {
MullvadFilterChip(
text = stringResource(id = R.string.setting_chip, stringResource(id = R.string.daita)),
onRemoveClick = {},
showIcon = false,
enabled = false,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,24 @@ import net.mullvad.mullvadvpn.lib.theme.shape.chipShape

@Preview
@Composable
private fun PreviewMullvadFilterChip() {
private fun PreviewEnabledMullvadFilterChip() {
AppTheme {
MullvadFilterChip(
text = stringResource(id = R.string.number_of_providers),
onRemoveClick = {},
showIcon = true,
enabled = true,
)
}
}

@Preview
@Composable
private fun PreviewDisabledMullvadFilterChip() {
AppTheme {
MullvadFilterChip(
text = stringResource(id = R.string.number_of_providers),
onRemoveClick = {},
enabled = false,
)
}
}
Expand All @@ -37,14 +49,17 @@ fun MullvadFilterChip(
iconColor: Color = MaterialTheme.colorScheme.onPrimary,
text: String,
onRemoveClick: () -> Unit,
showIcon: Boolean,
enabled: Boolean,
) {
InputChip(
enabled = enabled,
shape = MaterialTheme.shapes.chipShape,
colors =
FilterChipDefaults.filterChipColors(
containerColor = containerColor,
disabledContainerColor = containerColor,
labelColor = labelColor,
disabledLabelColor = labelColor,
iconColor = iconColor,
),
border =
Expand All @@ -57,7 +72,7 @@ fun MullvadFilterChip(
onClick = onRemoveClick,
label = { Text(text = text, style = MaterialTheme.typography.labelMedium) },
trailingIcon = {
if (showIcon) {
if (enabled) {
Icon(
painter = painterResource(id = R.drawable.icon_close),
contentDescription = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sealed interface FilterChip {

data class Provider(val count: Int) : FilterChip

object Daita : FilterChip
data object Daita : FilterChip
}

enum class RelayListItemContentType {
Expand Down

0 comments on commit f5072fe

Please sign in to comment.