diff --git a/README.md b/README.md index 26bdaf4..7902581 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![version](https://img.shields.io/badge/version-1.0.3-blue) +![version](https://img.shields.io/badge/version-1.0.4-blue) ## How to use? in your project diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1318e3d..71e34a8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,8 @@ + + + + diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Avatar.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Avatar.kt new file mode 100644 index 0000000..8a79a8c --- /dev/null +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Avatar.kt @@ -0,0 +1,138 @@ +package com.b1nd.dodam.designsystem.component + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +import androidx.compose.runtime.Stable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ColorFilter +import androidx.compose.ui.graphics.DefaultAlpha +import androidx.compose.ui.graphics.painter.Painter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import coil3.compose.AsyncImage +import coil3.request.ImageRequest +import com.b1nd.dodam.designsystem.DodamTheme +import com.b1nd.dodam.designsystem.foundation.DodamIcons + + +@Composable +fun DodamAvatar( + modifier: Modifier = Modifier, + avatarSize: AvatarSize, + model: Any? = null, + contentDescription: String? = null, + colorFilter: ColorFilter? = null, + alpha: Float = DefaultAlpha, + contentScale: ContentScale = ContentScale.Fit, +) { + + val avatarConfig = avatarSize.getAvatarConfig() + + when (model) { + is String, is ImageRequest -> { + DodamAsyncAvatar( + modifier = modifier + .size(avatarConfig.backgroundSize), + model = model, + contentDescription = contentDescription, + colorFilter = colorFilter, + alpha = alpha, + contentScale = contentScale + ) + } + else -> { + Box( + modifier = modifier + .size(avatarConfig.backgroundSize) + .background( + color = DodamTheme.colors.fillNormal, + shape = CircleShape + ) + ) { + Image( + modifier = Modifier + .size(avatarConfig.iconSize) + .align(Alignment.Center), + imageVector = DodamIcons.Person.value, + contentDescription = contentDescription, + alpha = alpha, + colorFilter = colorFilter?: ColorFilter.tint(DodamTheme.colors.fillAlternative), + contentScale = contentScale + ) + } + } + } +} + +@Composable +private fun DodamAsyncAvatar( + modifier: Modifier = Modifier, + model: Any, + contentDescription: String?, + colorFilter: ColorFilter?, + alpha: Float, + contentScale: ContentScale +) { + AsyncImage( + modifier = modifier, + model = model, + contentDescription = contentDescription, + colorFilter = colorFilter, + alpha = alpha, + contentScale = contentScale + ) +} + +@Stable +enum class AvatarSize { + ExtraSmall, + Small, + Medium, + Large, + ExtraLarge, + XXL, +} + +@Immutable +data class AvatarConfig( + val backgroundSize: Dp, + val iconSize: Dp +) + + + +@Composable +private fun AvatarSize.getAvatarConfig() = + when (this) { + AvatarSize.ExtraSmall -> AvatarConfig(AvatarDefaults.ExtraSmallBackgroundSize, AvatarDefaults.ExtraSmallIconSize) + AvatarSize.Small -> AvatarConfig(AvatarDefaults.SmallBackgroundSize, AvatarDefaults.SmallIconSize) + AvatarSize.Medium -> AvatarConfig(AvatarDefaults.MediumBackgroundSize, AvatarDefaults.MediumIconSize) + AvatarSize.Large -> AvatarConfig(AvatarDefaults.LargeBackgroundSize, AvatarDefaults.LargeIconSize) + AvatarSize.ExtraLarge -> AvatarConfig(AvatarDefaults.ExtraLargeBackgroundSize, AvatarDefaults.ExtraLargeIconSize) + AvatarSize.XXL -> AvatarConfig(AvatarDefaults.XXLBackgroundSize, AvatarDefaults.XXLIconSize) + } + +private object AvatarDefaults { + val ExtraSmallBackgroundSize = 16.dp + val SmallBackgroundSize = 24.dp + val MediumBackgroundSize = 32.dp + val LargeBackgroundSize = 36.dp + val ExtraLargeBackgroundSize = 64.dp + val XXLBackgroundSize = 128.dp + + val ExtraSmallIconSize = 10.dp + val SmallIconSize = 15.dp + val MediumIconSize = 20.dp + val LargeIconSize = 22.5.dp + val ExtraLargeIconSize = 40.dp + val XXLIconSize = 80.dp +} \ No newline at end of file diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Badge.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Badge.kt new file mode 100644 index 0000000..30c4074 --- /dev/null +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Badge.kt @@ -0,0 +1,46 @@ +package com.b1nd.dodam.designsystem.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.b1nd.dodam.designsystem.DodamTheme + +@Composable +fun DodamBadge( + modifier: Modifier = Modifier, + count: String? = null, +) { + if (count == null) { + Box( + modifier = modifier + .size(8.dp) + .background( + color = DodamTheme.colors.statusNegative, + shape = CircleShape + ) + ) + } else { + Box( + modifier = modifier + .background( + color = DodamTheme.colors.statusNegative, + shape = CircleShape + ), + contentAlignment = Alignment.Center + ) { + Text( + modifier = Modifier.padding(horizontal = 6.dp), + text = count, + style = DodamTheme.typography.labelMedium(), + color = DodamTheme.colors.staticWhite + ) + } + } +} \ No newline at end of file diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Indicator.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Indicator.kt new file mode 100644 index 0000000..5d38276 --- /dev/null +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Indicator.kt @@ -0,0 +1,128 @@ +package com.b1nd.dodam.designsystem.component + +import androidx.annotation.FloatRange +import androidx.compose.foundation.Canvas +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.requiredHeight +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.pager.PagerState +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.runtime.Composable +import androidx.compose.runtime.ReadOnlyComposable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.draw.drawWithContent +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.StrokeCap +import androidx.compose.ui.graphics.drawscope.Stroke +import androidx.compose.ui.unit.dp +import com.b1nd.dodam.designsystem.DodamTheme +import org.jetbrains.compose.ui.tooling.preview.Preview + +@OptIn(ExperimentalFoundationApi::class) +@Composable +fun DodamPageIndicator( + modifier: Modifier = Modifier, + pagerState: PagerState +) { + if (pagerState.pageCount > 1) { + Row(modifier = modifier) { + val lastIndex = pagerState.pageCount - 1 + repeat(pagerState.pageCount) { iteration -> + val color = + if (pagerState.currentPage == iteration) { + DodamTheme.colors.primaryNormal + } else { + DodamTheme.colors.labelDisabled + } + + Box( + modifier = Modifier + .clip(CircleShape) + .background(color) + .size(5.dp), + ) + if (lastIndex != iteration) { + Spacer(Modifier.width(5.dp)) + } + } + } + } +} + +@Composable +fun DodamLinerProgressIndicator( + modifier: Modifier, + @FloatRange(from = 0.0, to = 1.0) progress: Float, + disabled: Boolean = false, +) { + require(progress in 0f..1f) { "Progress must range from 0 to 1." } + + + Row( + modifier = modifier + .height(LinerProgressIndicatorDefault.DefaultHeight) + .background( + color = DodamTheme.colors.lineAlternative, + shape = LinerProgressIndicatorDefault.DefaultShape + ) + ) { + Box( + modifier = Modifier + .weight(progress) + .background( + color = if (disabled) DodamTheme.colors.lineNormal + else DodamTheme.colors.primaryNormal, + shape = LinerProgressIndicatorDefault.DefaultShape + ) + .fillMaxHeight() + ) + Spacer(Modifier.weight(1f-progress)) + } +} + +@Composable +fun DodamCircularProgressIndicator( + modifier: Modifier, + @FloatRange(from = 0.0, to = 1.0) progress: Float, + disabled: Boolean = false, +) { + require(progress in 0f..1f) { "Progress must range from 0 to 1." } + + val lineAlternative = DodamTheme.colors.lineAlternative + val arcColor = if (disabled) DodamTheme.colors.lineNormal else DodamTheme.colors.primaryNormal + Canvas(modifier = modifier) { + drawCircle( + color = lineAlternative, + radius = size.minDimension / 2, + style = Stroke(width = 10.dp.toPx()) + ) + + drawArc( + color = arcColor, + startAngle = -90f, + sweepAngle = 360f * progress, + useCenter = false, + style = Stroke(width = 10.dp.toPx(), cap = StrokeCap.Round) + ) + } +} + + +private object LinerProgressIndicatorDefault { + val DefaultHeight = 14.dp + + val DefaultShape + @ReadOnlyComposable + @Composable + get() = DodamTheme.shapes.extraSmall +} \ No newline at end of file diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Tag.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Tag.kt new file mode 100644 index 0000000..eb06b28 --- /dev/null +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Tag.kt @@ -0,0 +1,77 @@ +package com.b1nd.dodam.designsystem.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +import androidx.compose.runtime.Stable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import com.b1nd.dodam.designsystem.DodamTheme + +@Composable +fun DodamTag( + modifier: Modifier = Modifier, + text: String, + tagType: TagType +) { + val colors = tagType.getColors() + + Box( + modifier = modifier + .background( + color = colors.backgroundColor, + shape = TagDefaults.DefaultShape + ) + ) { + Text( + modifier = Modifier + .padding( + horizontal = 12.dp, + vertical = 2.dp + ), + text = text, + color = colors.textColor, + style = DodamTheme.typography.body1Bold().copy(fontWeight = FontWeight.Bold) + ) + } + +} + + +@Stable +enum class TagType { + Primary, + Secondary, + Negative +} + +@Immutable +data class TagColor( + val backgroundColor: Color, + val textColor: Color +) + +@Composable +private fun TagType.getColors() = + when (this) { + TagType.Primary -> TagColor(TagDefaults.primaryBackground, TagDefaults.textColor) + TagType.Secondary -> TagColor(TagDefaults.secondaryBackground, TagDefaults.textColor) + TagType.Negative -> TagColor(TagDefaults.negativeBackground, TagDefaults.textColor) + } + + +private object TagDefaults { + val DefaultShape = CircleShape + + val primaryBackground @Composable get() = DodamTheme.colors.primaryNormal + val secondaryBackground @Composable get() = DodamTheme.colors.lineNormal + val negativeBackground @Composable get() = DodamTheme.colors.statusNegative + + val textColor @Composable get() = DodamTheme.colors.staticWhite +} \ No newline at end of file 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 22166a5..da1b03f 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 @@ -10,6 +10,7 @@ import com.b1nd.dodam.designsystem.tokens.ColorLightTokens data class DodamColors( val primaryNormal: Color, val primaryAssistive: Color, + val primaryAlternative: Color, val labelNormal: Color, val labelStrong: Color, val labelNeutral: Color, @@ -36,6 +37,7 @@ data class DodamColors( internal fun lightDodamColors( primaryNormal: Color = ColorLightTokens.Primary.Normal, primaryDisabled: Color = ColorLightTokens.Primary.Assistive, + primaryAlternative: Color = ColorLightTokens.Primary.Alternative, labelNormal: Color = ColorLightTokens.Label.Normal, labelStrong: Color = ColorLightTokens.Label.Strong, labelNeutral: Color = ColorLightTokens.Label.Neutral, @@ -60,6 +62,7 @@ internal fun lightDodamColors( ): DodamColors = DodamColors( primaryNormal = primaryNormal, primaryAssistive = primaryDisabled, + primaryAlternative = primaryAlternative, labelNormal = labelNormal, labelStrong = labelStrong, labelNeutral = labelNeutral, @@ -86,6 +89,7 @@ internal fun lightDodamColors( internal fun darkDodamColors( primaryNormal: Color = ColorDarkTokens.Primary.Normal, primaryDisabled: Color = ColorDarkTokens.Primary.Assistive, + primaryAlternative: Color = ColorDarkTokens.Primary.Alternative, labelNormal: Color = ColorDarkTokens.Label.Normal, labelStrong: Color = ColorDarkTokens.Label.Strong, labelNeutral: Color = ColorDarkTokens.Label.Neutral, @@ -110,6 +114,7 @@ internal fun darkDodamColors( ): DodamColors = DodamColors( primaryNormal = primaryNormal, primaryAssistive = primaryDisabled, + primaryAlternative = primaryAlternative, labelNormal = labelNormal, labelStrong = labelStrong, labelNeutral = labelNeutral, diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/foundation/DodamIcons.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/foundation/DodamIcons.kt index 7ab0dc0..fe04aa5 100644 --- a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/foundation/DodamIcons.kt +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/foundation/DodamIcons.kt @@ -24,6 +24,7 @@ import com.b1nd.dodam.designsystem.resources.ic_megaphone import com.b1nd.dodam.designsystem.resources.ic_menu import com.b1nd.dodam.designsystem.resources.ic_moon_plus import com.b1nd.dodam.designsystem.resources.ic_note +import com.b1nd.dodam.designsystem.resources.ic_person import com.b1nd.dodam.designsystem.resources.ic_plus import com.b1nd.dodam.designsystem.resources.ic_trash import com.b1nd.dodam.designsystem.resources.ic_xmark_circle @@ -53,7 +54,8 @@ enum class DodamIcons { ChevronLeft, Trash, MagnifyingGlass, - Gear; + Gear, + Person; val value: ImageVector @Composable @@ -83,5 +85,6 @@ enum class DodamIcons { Trash -> vectorResource(Res.drawable.ic_trash) MagnifyingGlass -> vectorResource(Res.drawable.ic_magnifyingglass) Gear -> vectorResource(Res.drawable.ic_gear) + Person -> vectorResource(Res.drawable.ic_person) } } 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 da329ab..38cead2 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 @@ -3,7 +3,8 @@ package com.b1nd.dodam.designsystem.tokens internal object ColorDarkTokens { object Primary { val Normal = PaletteTokens.Blue45 - val Assistive = PaletteTokens.Blue45.copy(alpha = 0.3f) + val Assistive = PaletteTokens.Blue45.copy(alpha = 0.2f) + val Alternative = PaletteTokens.Blue45.copy(alpha = 0.65f) } object Label { 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 d47b17b..b76b6b7 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 @@ -3,7 +3,8 @@ package com.b1nd.dodam.designsystem.tokens internal object ColorLightTokens { object Primary { val Normal = PaletteTokens.Blue45 - val Assistive = PaletteTokens.Blue45.copy(alpha = 0.3f) + val Assistive = PaletteTokens.Blue45.copy(alpha = 0.2f) + val Alternative = PaletteTokens.Blue45.copy(alpha = 0.65f) } object Label { diff --git a/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamAvatarPreview.kt b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamAvatarPreview.kt new file mode 100644 index 0000000..1007965 --- /dev/null +++ b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamAvatarPreview.kt @@ -0,0 +1,44 @@ +package com.b1nd.dodam.designsystem.previews + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.b1nd.dodam.designsystem.DodamTheme +import com.b1nd.dodam.designsystem.component.AvatarSize +import com.b1nd.dodam.designsystem.component.DodamAvatar + +@Composable +@Preview +fun DodamAvatarPreview( + +){ + DodamTheme { + Column( + modifier = Modifier + .fillMaxSize() + .background(DodamTheme.colors.backgroundNormal) + ) { + DodamAvatar( + avatarSize = AvatarSize.ExtraSmall + ) + DodamAvatar( + avatarSize = AvatarSize.Small + ) + DodamAvatar( + avatarSize = AvatarSize.Medium + ) + DodamAvatar( + avatarSize = AvatarSize.Large + ) + DodamAvatar( + avatarSize = AvatarSize.ExtraLarge + ) + DodamAvatar( + avatarSize = AvatarSize.XXL + ) + } + } +} \ No newline at end of file diff --git a/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamBadgePreview.kt b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamBadgePreview.kt new file mode 100644 index 0000000..811910c --- /dev/null +++ b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamBadgePreview.kt @@ -0,0 +1,40 @@ +package com.b1nd.dodam.designsystem.previews + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.width +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.b1nd.dodam.designsystem.DodamTheme +import com.b1nd.dodam.designsystem.component.DodamBadge + +@Composable +@Preview +fun DodamBadgePreview( + +){ + DodamTheme { + Column( + modifier = Modifier + .fillMaxSize() + .background(DodamTheme.colors.backgroundNormal) + ) { + Row { + DodamBadge() + Spacer(modifier = Modifier.width(30.dp)) + DodamBadge( + count = "1" + ) + Spacer(modifier = Modifier.width(30.dp)) + DodamBadge( + count = "999+" + ) + } + } + } +} \ No newline at end of file diff --git a/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamIndicatorPreview.kt b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamIndicatorPreview.kt new file mode 100644 index 0000000..21b71c0 --- /dev/null +++ b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamIndicatorPreview.kt @@ -0,0 +1,67 @@ +package com.b1nd.dodam.designsystem.previews + +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.pager.HorizontalPager +import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.b1nd.dodam.designsystem.DodamTheme +import com.b1nd.dodam.designsystem.component.DodamCircularProgressIndicator +import com.b1nd.dodam.designsystem.component.DodamLinerProgressIndicator +import com.b1nd.dodam.designsystem.component.DodamPageIndicator + +@OptIn(ExperimentalFoundationApi::class) +@Preview +@Composable +private fun DodamIndicatorPreview() { + + val pagerState = rememberPagerState { + 3 + } + DodamTheme { + Column( + modifier = Modifier + .fillMaxSize() + .background(DodamTheme.colors.backgroundNormal) + ) { + HorizontalPager( + modifier = Modifier.fillMaxWidth(), + state = pagerState + ) { + Text(text = it.toString()) + } + DodamPageIndicator( + modifier = Modifier.align(Alignment.End), + pagerState = pagerState + ) + Spacer(modifier = Modifier.height(16.dp)) + DodamLinerProgressIndicator( + modifier = Modifier.fillMaxWidth(), + progress = 0.3f + ) + Spacer(modifier = Modifier.height(8.dp)) + DodamLinerProgressIndicator( + modifier = Modifier + .fillMaxWidth(), + progress = 0.3f, + disabled = true + ) + Spacer(modifier = Modifier.height(8.dp)) + DodamCircularProgressIndicator( + modifier = Modifier.size(50.dp), + progress = 0.5f, + ) + } + } +} \ No newline at end of file diff --git a/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamTagPreview.kt b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamTagPreview.kt new file mode 100644 index 0000000..4505078 --- /dev/null +++ b/dodam-design-system/src/main/java/com/b1nd/dodam/designsystem/previews/DodamTagPreview.kt @@ -0,0 +1,41 @@ +package com.b1nd.dodam.designsystem.previews + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.b1nd.dodam.designsystem.DodamTheme +import com.b1nd.dodam.designsystem.component.DodamTag +import com.b1nd.dodam.designsystem.component.TagType + +@Composable +@Preview +private fun DodamTagPreview( + +) { + + DodamTheme( + darkTheme = true + ) { + Column( + modifier = Modifier + .fillMaxSize() + .background(DodamTheme.colors.backgroundNormal) + ) { + DodamTag( + text = "아침", + tagType = TagType.Primary + ) + DodamTag( + text = "아침", + tagType = TagType.Secondary + ) + DodamTag( + text = "아침", + tagType = TagType.Negative + ) + } + } +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0ba6b4d..fe81f46 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,6 +8,8 @@ versionCode = "1" # kotlin kotlin = "2.0.0" kotlinx-collections-immutable = "0.3.7" +kotlinx-io = "0.5.3" +kotlinx-serialization-json = "1.6.2" # compose compose-plugin = "1.6.11" @@ -22,8 +24,16 @@ androidx-activity-compose = "1.9.0" androidx-compose-bom = "2024.06.00" uiAndroid = "1.6.8" +# third + +coil = "3.0.0-alpha06" +ktor = "3.0.0-wasm2" + [libraries] kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } +kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" } +kotlinx-io-bytestring = {group = "org.jetbrains.kotlinx", name = "kotlinx-io-bytestring", version.ref = "kotlinx-io" } +kotlinx-io-core = {group = "org.jetbrains.kotlinx", name = "kotlinx-io-core", version.ref = "kotlinx-io" } kotlinx-collections-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "kotlinx-collections-immutable" } androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidx-compose-bom" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } @@ -47,6 +57,15 @@ compose-components-ui-tooling-preview = { group = "org.jetbrains.compose.compone compose-ui-tooling-preview = { group = "org.jetbrains.compose.ui", name = "ui-tooling-preview", version.ref = "compose-plugin"} +ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" } +ktor-client-darwin = { group = "io.ktor", name = "ktor-client-darwin", version.ref = "ktor" } +coil-compose = { group = "io.coil-kt.coil3", name = "coil-compose", version.ref = "coil" } +coil-compose-core = { group = "io.coil-kt.coil3", name = "coil-compose-core" , version.ref = "coil"} +coil-network-ktor = { group = "io.coil-kt.coil3", name = "coil-network-ktor" , version.ref = "coil"} +coil-network-okhttp = { group = "io.coil-kt.coil3", name = "coil-network-okhttp" , version.ref = "coil"} +coil = { group = "io.coil-kt.coil3", name = "coil" , version.ref = "coil"} + + [plugins] android-application = { id = "com.android.application", version.ref = "agp" } android-library = { id = "com.android.library", version.ref = "agp" } diff --git a/settings.gradle.kts b/settings.gradle.kts index dcf7add..51c8297 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -17,6 +17,7 @@ dependencyResolutionManagement { google() mavenCentral() maven("https://jitpack.io") + maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental") } }