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

[Feat/#15] selector components #20

Merged
merged 14 commits into from
Jan 14, 2025
Merged
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
41 changes: 24 additions & 17 deletions app/src/main/java/org/memento/presentation/MementoChipSelector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import org.memento.R
import org.memento.domain.type.SelectorType
import org.memento.presentation.util.changeHexToColor
import org.memento.presentation.util.noRippleClickable

@Composable
Expand All @@ -30,7 +31,7 @@ fun MementoChipSelector(
isClicked: Boolean = false,
onClickedChange: (Boolean) -> Unit = {},
content: String,
tagColor: Color = Color.Unspecified,
tagColor: String?,
modifier: Modifier = Modifier,
) {
var clicked by remember { mutableStateOf(isClicked) }
Expand All @@ -42,7 +43,6 @@ fun MementoChipSelector(
.clip(RoundedCornerShape(selectorType.cornerRadius))
.background(color = if (clicked) selectorType.clickedBackgroundColor else selectorType.unClickedBackgroundColor)
.noRippleClickable {
// Todo : Selector ํ˜ธ์ถœํ•˜๊ณ  ๊ทธ์— ๋”ฐ๋ผ ์ปฌ๋Ÿฌ ์ฒด์ธ์ง€ ๋กœ์ง
clicked = !clicked
onClickedChange(clicked)
},
Expand All @@ -51,7 +51,7 @@ fun MementoChipSelector(
when (selectorType) {
SelectorType.TIMESELECTOR -> {
Text(
text = "00:00 AM",
text = R.string.time_example.toString(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

p3:
contentDescription = stringResource(id = R.string.tag_icon),
์ด๋ ‡๊ฒŒ์“ฐ๋ฉด ๋’ค์— toString์•ˆ๋ถ™์—ฌ๋„ ๋˜์˜

style = selectorType.textStyle,
color = Color.Transparent,
modifier =
Expand All @@ -69,12 +69,15 @@ fun MementoChipSelector(

SelectorType.DATESELECTOR -> {
Text(
text = "Jan 30, 2025",
text = R.string.date_example.toString(),
style = selectorType.textStyle,
color = Color.Transparent,
modifier =
Modifier
.padding(horizontal = selectorType.paddingHorizontal, vertical = selectorType.paddingVertical),
.padding(
horizontal = selectorType.paddingHorizontal,
vertical = selectorType.paddingVertical,
),
)
Text(
text = content,
Expand All @@ -84,7 +87,6 @@ fun MementoChipSelector(
}

SelectorType.TAG -> {
// TODO : ์„œ๋ฒ„์—์„œ HEXCODE ๋ฐ›์•„ ์ ์šฉํ•˜๋Š” ๋กœ์ง -> ์ƒ‰์ƒ์„ ๋ฐ›์œผ๋ฉด ์›์•ˆ์— ๊ทธ ์ƒ‰์„ ๋„ฃ์ž
Box(
modifier =
Modifier
Expand All @@ -100,12 +102,12 @@ fun MementoChipSelector(
) {
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_tag),
contentDescription = "null",
contentDescription = null,
tint = Color.Transparent,
modifier = Modifier.padding(end = 5.dp),
)
Text(
text = "Today",
text = R.string.Today.toString(),
style = selectorType.textStyle,
color = Color.Transparent,
)
Expand All @@ -116,12 +118,14 @@ fun MementoChipSelector(
.align(Alignment.Center),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_tag),
contentDescription = "Tag Icon",
tint = tagColor,
modifier = Modifier.padding(end = 5.dp),
)
tagColor?.let { changeHexToColor(hex = it) }?.let {
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_tag),
contentDescription = R.string.tag_icon.toString(),
tint = it,
modifier = Modifier.padding(end = 5.dp),
)
}
Text(
text = content,
style = selectorType.textStyle,
Expand All @@ -143,7 +147,7 @@ fun MementoChipSelector(
) {
Image(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_deadline),
contentDescription = "Deadline Icon",
contentDescription = R.string.deadline_icon.toString(),
modifier = Modifier.padding(end = 5.dp),
)
Text(
Expand All @@ -156,12 +160,15 @@ fun MementoChipSelector(

SelectorType.BASIC -> {
Text(
text = "Today",
text = R.string.Today.toString(),
style = selectorType.textStyle,
color = Color.Transparent,
modifier =
Modifier
.padding(horizontal = selectorType.paddingHorizontal, vertical = selectorType.paddingVertical),
.padding(
horizontal = selectorType.paddingHorizontal,
vertical = selectorType.paddingVertical,
),
)
Text(
text = content,
Expand Down