Skip to content

Commit

Permalink
Adds 3 new options for ButtonStyle
Browse files Browse the repository at this point in the history
ON_PRIMARY, ON_SECONDARY, ON_TERTIARY
  • Loading branch information
Tweener committed Jul 12, 2024
1 parent 2dbc91f commit e754819
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.tweener.czan.designsystem.atom.icon.Icon
import com.tweener.czan.designsystem.atom.text.Text
import com.tweener.czan.theme.Size
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi

/**
* @author Vivien Mahe
Expand Down Expand Up @@ -43,7 +42,6 @@ fun Button(
)
}

@OptIn(ExperimentalResourceApi::class)
@Composable
fun Button(
modifier: Modifier = Modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ import com.tweener.czan.theme.CzanUiDefaults
*/
enum class ButtonStyle {
PRIMARY,
ON_PRIMARY,
SECONDARY,
ON_SECONDARY,
TERTIARY,
ON_TERTIARY,
ERROR;

val containerColor: Color
@Composable
@ReadOnlyComposable
get() = when (this) {
PRIMARY -> MaterialTheme.colorScheme.primary
ON_PRIMARY -> MaterialTheme.colorScheme.onPrimary
SECONDARY -> MaterialTheme.colorScheme.secondary
ON_SECONDARY -> MaterialTheme.colorScheme.onSecondary
TERTIARY -> MaterialTheme.colorScheme.tertiary
ON_TERTIARY -> MaterialTheme.colorScheme.onTertiary
ERROR -> MaterialTheme.colorScheme.error
}

Expand All @@ -31,8 +37,11 @@ enum class ButtonStyle {
@ReadOnlyComposable
get() = when (this) {
PRIMARY -> MaterialTheme.colorScheme.onPrimary
ON_PRIMARY -> MaterialTheme.colorScheme.primary
SECONDARY -> MaterialTheme.colorScheme.onSecondary
ON_SECONDARY -> MaterialTheme.colorScheme.secondary
TERTIARY -> MaterialTheme.colorScheme.onTertiary
ON_TERTIARY -> MaterialTheme.colorScheme.tertiary
ERROR -> MaterialTheme.colorScheme.onError
}

Expand Down
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dependencyVersionsPlugin = "0.51.0"
nexusSonatype = "2.0.0"
dokka = "1.9.20"
androidAnnotations = "1.8.0"
coroutines = "1.8.1"
shimmer = "1.2.0"
cupertinoCompose = "0.1.0-alpha03"
ktor = "2.3.11"
Expand All @@ -18,7 +17,7 @@ tweenerBom = "2.0.1"
# Android
androidDesugarJdkLibs = "2.0.4"
androidActivityCompose = "1.9.0"
androidLifecycleCompose = "2.8.2"
androidLifecycleCompose = "2.8.3"
androidAccompanist = "0.34.0"

[libraries]
Expand Down

0 comments on commit e754819

Please sign in to comment.