Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.0.1 #5

Merged
merged 5 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions dodam-design-system/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -65,7 +66,7 @@ mavenPublishing {
coordinates(
groupId = "com.b1nd.dodam",
artifactId = "dodam-design-system",
version = "1.0.0"
version = "1.0.1"
)

pom {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -66,7 +72,7 @@ fun DodamModalBottomSheet(
)
) {
title()
Spacer(modifier = Modifier.height(4.dp))
Spacer(modifier = Modifier.height(space))
content()
Spacer(modifier = Modifier.navigationBarsPadding())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -66,6 +68,7 @@ internal fun lightDodamColors(
labelDisabled = labelDisabled,
backgroundNormal = backgroundNormal,
backgroundAlternative = backgroundAlternative,
backgroundNeutral = backgroundNeutral,
lineNormal = lineNormal,
lineNeutral = lineNeutral,
lineAlternative = lineAlternative,
Expand All @@ -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,
Expand All @@ -114,6 +118,7 @@ internal fun darkDodamColors(
labelDisabled = labelDisabled,
backgroundNormal = backgroundNormal,
backgroundAlternative = backgroundAlternative,
backgroundNeutral = backgroundNeutral,
lineNormal = lineNormal,
lineNeutral = lineNeutral,
lineAlternative = lineAlternative,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal object ColorDarkTokens {
object Background {
val Normal = PaletteTokens.Neutral15
val Alternative = PaletteTokens.Neutral5
val Neutral = PaletteTokens.Neutral99
}

object Line {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal object ColorLightTokens {
object Background {
val Normal = PaletteTokens.White
val Alternative = PaletteTokens.Neutral99
val Neutral = PaletteTokens.Neutral10
}

object Line {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
}
}
}