From 1b528cb8efbbabe3ec747f1eff712e601d88d299 Mon Sep 17 00:00:00 2001 From: dean Date: Tue, 24 Sep 2024 16:56:34 +0900 Subject: [PATCH 1/2] =?UTF-8?q?BezierTag=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bezier/compose/component/tag/BezierTag.kt | 50 +++++++++++++++++++ .../tag/properties/BezierTagColor.kt | 46 +++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 bezier/src/main/java/io/channel/bezier/compose/component/tag/BezierTag.kt create mode 100644 bezier/src/main/java/io/channel/bezier/compose/component/tag/properties/BezierTagColor.kt diff --git a/bezier/src/main/java/io/channel/bezier/compose/component/tag/BezierTag.kt b/bezier/src/main/java/io/channel/bezier/compose/component/tag/BezierTag.kt new file mode 100644 index 0000000..17b3966 --- /dev/null +++ b/bezier/src/main/java/io/channel/bezier/compose/component/tag/BezierTag.kt @@ -0,0 +1,50 @@ +package io.channel.bezier.compose.component.tag + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import io.channel.bezier.BezierTheme +import io.channel.bezier.compose.component.tag.properties.BezierTagColor + +@Composable +fun BezierTag( + text: String, + color: BezierTagColor, +) { + Text( + modifier = Modifier + .clip(RoundedCornerShape(8.dp)) + .background(color.backgroundColor().color) + .padding(horizontal = 8.dp, vertical = 3.dp) + .padding(horizontal = 3.dp), + text = text, + style = BezierTheme.typography.body2Regular, + color = BezierTheme.colorSchemes.fgBlackDarkest.color, + ) +} + +@Preview(showBackground = true) +@Composable +private fun BezierTagPreview() { + BezierTheme { + Column( + modifier = Modifier.padding(16.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + BezierTagColor.entries.forEach { color -> + BezierTag( + text = "Label", + color = color, + ) + } + } + } +} diff --git a/bezier/src/main/java/io/channel/bezier/compose/component/tag/properties/BezierTagColor.kt b/bezier/src/main/java/io/channel/bezier/compose/component/tag/properties/BezierTagColor.kt new file mode 100644 index 0000000..a4049f3 --- /dev/null +++ b/bezier/src/main/java/io/channel/bezier/compose/component/tag/properties/BezierTagColor.kt @@ -0,0 +1,46 @@ +package io.channel.bezier.compose.component.tag.properties + +import androidx.compose.runtime.Composable +import io.channel.bezier.BezierTheme +import io.channel.bezier.compose.color_v2.BezierColor + +enum class BezierTagColor( + internal val backgroundColor: @Composable () -> BezierColor, +) { + Default( + backgroundColor = { BezierTheme.colorSchemes.bgBlackLighter }, + ), + Blue( + backgroundColor = { BezierTheme.colorSchemes.bgBlueShadeLight }, + ), + Cobalt( + backgroundColor = { BezierTheme.colorSchemes.bgCobaltShadeLight }, + ), + Teal( + backgroundColor = { BezierTheme.colorSchemes.bgTealShadeLight }, + ), + Green( + backgroundColor = { BezierTheme.colorSchemes.bgGreenShadeLight }, + ), + Olive( + backgroundColor = { BezierTheme.colorSchemes.bgOliveShadeLight }, + ), + Pink( + backgroundColor = { BezierTheme.colorSchemes.bgPinkShadeLight }, + ), + Navy( + backgroundColor = { BezierTheme.colorSchemes.bgNavyShadeLight }, + ), + Yellow( + backgroundColor = { BezierTheme.colorSchemes.bgYellowShadeLight }, + ), + Orange( + backgroundColor = { BezierTheme.colorSchemes.bgOrangeShadeLight }, + ), + Red( + backgroundColor = { BezierTheme.colorSchemes.bgRedShadeLight }, + ), + Purple( + backgroundColor = { BezierTheme.colorSchemes.bgPurpleShadeLight }, + ), +} From 1acf7d23a6fd5ec77ce05427f884e40498dced8e Mon Sep 17 00:00:00 2001 From: dean Date: Tue, 24 Sep 2024 17:26:10 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=ED=83=9C=EA=B7=B8=20Box=20=EC=95=88?= =?UTF-8?q?=EC=97=90=20=ED=91=9C=EC=8B=9C=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bezier/compose/component/tag/BezierTag.kt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bezier/src/main/java/io/channel/bezier/compose/component/tag/BezierTag.kt b/bezier/src/main/java/io/channel/bezier/compose/component/tag/BezierTag.kt index 17b3966..14cc207 100644 --- a/bezier/src/main/java/io/channel/bezier/compose/component/tag/BezierTag.kt +++ b/bezier/src/main/java/io/channel/bezier/compose/component/tag/BezierTag.kt @@ -2,6 +2,7 @@ package io.channel.bezier.compose.component.tag import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape @@ -19,16 +20,20 @@ fun BezierTag( text: String, color: BezierTagColor, ) { - Text( + Box( modifier = Modifier .clip(RoundedCornerShape(8.dp)) .background(color.backgroundColor().color) - .padding(horizontal = 8.dp, vertical = 3.dp) - .padding(horizontal = 3.dp), - text = text, - style = BezierTheme.typography.body2Regular, - color = BezierTheme.colorSchemes.fgBlackDarkest.color, - ) + .padding(horizontal = 8.dp, vertical = 3.dp), + ) { + Text( + modifier = Modifier + .padding(horizontal = 3.dp), + text = text, + style = BezierTheme.typography.body2Regular, + color = BezierTheme.colorSchemes.fgBlackDarkest.color, + ) + } } @Preview(showBackground = true)