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

[MOB-2040] BezierTag 추가 #77

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -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),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

horizontal 11로 합치거나 horizontal8, vertical3에 대한 Box를 추가하는건 어떠신가유?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

의미상 박스에 넣는 게 나아보이네요!

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 },
),
}