Skip to content

Commit

Permalink
WIP: Implement IvyButton
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolegeorgieva committed Nov 28, 2024
1 parent b3382d3 commit b7d77b1
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
39 changes: 39 additions & 0 deletions composeApp/src/commonMain/kotlin/component/button/IvyButton.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package component.button

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.material.Button
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

sealed interface ButtonStyle {
data class FilledButton(val state: ButtonState) : ButtonStyle
data class OutlinedButton(val state: ButtonState) : ButtonStyle
}

enum class ButtonState {
PrimaryVariant,
SecondaryVariant,
Success,
Error
}

@Composable
fun IvyButton(
style: ButtonStyle,
modifier: Modifier = Modifier,
enabled: Boolean = true,
text: String? = null,
icon: @Composable (() -> Unit)? = null,
iconRight: @Composable (() -> Unit)? = null,
onClick: () -> Unit,
) {
Button(
modifier = modifier,
enabled = enabled,
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp),
onClick = onClick
) {
// TODO
}
}
12 changes: 9 additions & 3 deletions composeApp/src/commonMain/kotlin/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,25 @@ val MaterialTheme.colorsExt: ExtendedColors
@ReadOnlyComposable
get() = if (MaterialTheme.colors.isLight) {
ExtendedColors(
success = Green,
onSuccess = Color.White,
backgroundVariant = Dark,
onBackgroundVariant = Color.White
onBackgroundVariant = Color.White,
)
} else {
ExtendedColors(
success = Green,
onSuccess = Color.White,
backgroundVariant = Light,
onBackgroundVariant = Color.Black
onBackgroundVariant = Color.Black,
)
}

data class ExtendedColors(
val backgroundVariant: Color,
val onBackgroundVariant: Color
val onBackgroundVariant: Color,
val success: Color,
val onSuccess: Color
)

private val DarkColorScheme = darkColors(
Expand Down

0 comments on commit b7d77b1

Please sign in to comment.