Skip to content

Commit

Permalink
[MOB-2040] BezierTag 추가 (#77)
Browse files Browse the repository at this point in the history
* BezierTag 추가

* 태그 Box 안에 표시하도록 변경
  • Loading branch information
sodp5 authored Sep 25, 2024
1 parent 30ef5c7 commit 190427e
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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
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,
) {
Box(
modifier = Modifier
.clip(RoundedCornerShape(8.dp))
.background(color.backgroundColor().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)
@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,
)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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 },
),
}

0 comments on commit 190427e

Please sign in to comment.