diff --git a/README.md b/README.md index 352f1df..bd4b1c9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-1.0.0-blue) +![version](https://img.shields.io/badge/version-1.0.1-blue) ## How to use? in your project diff --git a/dodam-design-system/build.gradle.kts b/dodam-design-system/build.gradle.kts index 4d15c1e..ab9ed61 100644 --- a/dodam-design-system/build.gradle.kts +++ b/dodam-design-system/build.gradle.kts @@ -36,7 +36,8 @@ kotlin { sourceSets { androidMain.dependencies { - implementation(libs.compose.ui.tooling.preview) + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.compose.ui.tooling) } commonMain.dependencies { @@ -65,7 +66,7 @@ mavenPublishing { coordinates( groupId = "com.b1nd.dodam", artifactId = "dodam-design-system", - version = "1.0.0" + version = "1.0.1" ) pom { diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Button.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Button.kt index 514e4d5..0107c0a 100644 --- a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Button.kt +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Button.kt @@ -32,6 +32,7 @@ import androidx.compose.ui.unit.dp import com.b1nd.dodam.designsystem.DodamTheme import com.b1nd.dodam.designsystem.animation.rememberBounceIndication import com.b1nd.dodam.designsystem.foundation.DodamIcons +import com.b1nd.dodam.designsystem.internal.`if` import org.jetbrains.compose.ui.tooling.preview.Preview @Composable @@ -58,7 +59,9 @@ fun DodamButton( interactionSource = interactionSource, indication = rememberBounceIndication(buttonConfig.shape), ) - .takeIf { enabled } ?: Modifier.alpha(0.5f), + .`if`(!enabled) { + alpha(0.5f) + }, shape = buttonConfig.shape, color = buttonColors.containerColor, contentColor = buttonColors.contentColor, diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/ModalBottomSheet.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/ModalBottomSheet.kt index d3a3ff1..4c39c6d 100644 --- a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/ModalBottomSheet.kt +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/ModalBottomSheet.kt @@ -19,6 +19,9 @@ import androidx.compose.material3.Text import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.b1nd.dodam.designsystem.DodamTheme import org.jetbrains.compose.ui.tooling.preview.Preview @@ -30,14 +33,17 @@ fun DodamModalBottomSheet( modifier: Modifier = Modifier, title: @Composable ColumnScope.() -> Unit, content: @Composable ColumnScope.() -> Unit, + containerColor: Color = DodamTheme.colors.backgroundNormal, + shape: Shape = DodamTheme.shapes.extraLarge, + space: Dp = 4.dp, sheetState: SheetState = rememberModalBottomSheetState(), ) { ModalBottomSheet( onDismissRequest = onDismissRequest, sheetState = sheetState, modifier = modifier, - containerColor = DodamTheme.colors.backgroundNormal, - shape = DodamTheme.shapes.extraLarge, + containerColor = containerColor, + shape = shape, dragHandle = { Surface( modifier = Modifier.padding( @@ -66,7 +72,7 @@ fun DodamModalBottomSheet( ) ) { title() - Spacer(modifier = Modifier.height(4.dp)) + Spacer(modifier = Modifier.height(space)) content() Spacer(modifier = Modifier.navigationBarsPadding()) } diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/foundation/DodamColors.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/foundation/DodamColors.kt index 51558ae..22166a5 100644 --- a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/foundation/DodamColors.kt +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/foundation/DodamColors.kt @@ -18,6 +18,7 @@ data class DodamColors( val labelDisabled: Color, val backgroundNormal: Color, val backgroundAlternative: Color, + val backgroundNeutral: Color, val lineNormal: Color, val lineNeutral: Color, val lineAlternative: Color, @@ -43,6 +44,7 @@ internal fun lightDodamColors( labelDisabled: Color = ColorLightTokens.Label.Disabled, backgroundNormal: Color = ColorLightTokens.Background.Normal, backgroundAlternative: Color = ColorLightTokens.Background.Alternative, + backgroundNeutral: Color = ColorLightTokens.Background.Neutral, lineNormal: Color = ColorLightTokens.Line.Normal, lineNeutral: Color = ColorLightTokens.Line.Neutral, lineAlternative: Color = ColorLightTokens.Line.Alternative, @@ -66,6 +68,7 @@ internal fun lightDodamColors( labelDisabled = labelDisabled, backgroundNormal = backgroundNormal, backgroundAlternative = backgroundAlternative, + backgroundNeutral = backgroundNeutral, lineNormal = lineNormal, lineNeutral = lineNeutral, lineAlternative = lineAlternative, @@ -91,6 +94,7 @@ internal fun darkDodamColors( labelDisabled: Color = ColorDarkTokens.Label.Disabled, backgroundNormal: Color = ColorDarkTokens.Background.Normal, backgroundAlternative: Color = ColorDarkTokens.Background.Alternative, + backgroundNeutral: Color = ColorDarkTokens.Background.Neutral, lineNormal: Color = ColorDarkTokens.Line.Normal, lineNeutral: Color = ColorDarkTokens.Line.Neutral, lineAlternative: Color = ColorDarkTokens.Line.Alternative, @@ -114,6 +118,7 @@ internal fun darkDodamColors( labelDisabled = labelDisabled, backgroundNormal = backgroundNormal, backgroundAlternative = backgroundAlternative, + backgroundNeutral = backgroundNeutral, lineNormal = lineNormal, lineNeutral = lineNeutral, lineAlternative = lineAlternative, diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/internal/IfModifier.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/internal/IfModifier.kt new file mode 100644 index 0000000..74c032b --- /dev/null +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/internal/IfModifier.kt @@ -0,0 +1,6 @@ +package com.b1nd.dodam.designsystem.internal + +import androidx.compose.ui.Modifier + +internal inline fun Modifier.`if`(enabled: Boolean, modifier: Modifier.() -> Modifier) = + if (enabled) modifier() else this \ No newline at end of file diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/tokens/ColorDarkTokens.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/tokens/ColorDarkTokens.kt index afdb1cd..f44cb8d 100644 --- a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/tokens/ColorDarkTokens.kt +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/tokens/ColorDarkTokens.kt @@ -18,6 +18,7 @@ internal object ColorDarkTokens { object Background { val Normal = PaletteTokens.Neutral15 val Alternative = PaletteTokens.Neutral5 + val Neutral = PaletteTokens.Neutral99 } object Line { diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/tokens/ColorLightTokens.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/tokens/ColorLightTokens.kt index f43ceac..db28051 100644 --- a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/tokens/ColorLightTokens.kt +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/tokens/ColorLightTokens.kt @@ -18,6 +18,7 @@ internal object ColorLightTokens { object Background { val Normal = PaletteTokens.White val Alternative = PaletteTokens.Neutral99 + val Neutral = PaletteTokens.Neutral10 } object Line { diff --git a/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamButtonPreview.kt b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamButtonPreview.kt index eb15154..9c329af 100644 --- a/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamButtonPreview.kt +++ b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamButtonPreview.kt @@ -3,6 +3,7 @@ package com.b1nd.dodam.designsystem.previews import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -142,6 +143,33 @@ private fun DodamButtonPreview() { loading = loading ) } + DodamButton( + modifier = Modifier.fillMaxWidth(), + onClick = { loading = true }, + buttonRole = ButtonRole.Assistive, + buttonSize = ButtonSize.Large, + text = "Button", + loading = loading, + enabled = !loading + ) + DodamButton( + modifier = Modifier.fillMaxWidth(), + onClick = { loading = true }, + buttonRole = ButtonRole.Assistive, + buttonSize = ButtonSize.Large, + text = "Button", + loading = loading, + enabled = loading + ) + DodamButton( + modifier = Modifier.fillMaxWidth(), + onClick = { loading = true }, + buttonRole = ButtonRole.Assistive, + buttonSize = ButtonSize.Large, + text = "Button", + loading = loading, + enabled = loading + ) } } }