Skip to content

Commit 3d04ed5

Browse files
committed
[BOOK-417] refactor: Emotion.kt designsystem 모듈로 이동
emotionTag 사용하지 않는 프로퍼티(textColor, bgColor) 제거
1 parent fb6e598 commit 3d04ed5

File tree

5 files changed

+38
-41
lines changed

5 files changed

+38
-41
lines changed

core/common/src/main/kotlin/com/ninecraft/booket/core/common/extensions/Emotion.kt

Lines changed: 0 additions & 22 deletions
This file was deleted.

core/designsystem/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ android {
1212
dependencies {
1313
implementations(
1414
projects.core.common,
15+
projects.core.model,
1516

1617
libs.androidx.splash,
1718

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.ninecraft.booket.core.designsystem
2+
3+
import androidx.compose.ui.graphics.Color
4+
import com.ninecraft.booket.core.designsystem.theme.InsightBgColor
5+
import com.ninecraft.booket.core.designsystem.theme.InsightTextColor
6+
import com.ninecraft.booket.core.designsystem.theme.JoyBgColor
7+
import com.ninecraft.booket.core.designsystem.theme.JoyTextColor
8+
import com.ninecraft.booket.core.designsystem.theme.SadnessBgColor
9+
import com.ninecraft.booket.core.designsystem.theme.SadnessTextColor
10+
import com.ninecraft.booket.core.designsystem.theme.WarmthBgColor
11+
import com.ninecraft.booket.core.designsystem.theme.WarmthTextColor
12+
import com.ninecraft.booket.core.model.Emotion
13+
14+
val Emotion.bgColor: Color
15+
get() = when (this) {
16+
Emotion.WARM -> WarmthBgColor
17+
Emotion.JOY -> JoyBgColor
18+
Emotion.SAD -> SadnessBgColor
19+
Emotion.INSIGHT -> InsightBgColor
20+
}
21+
22+
val Emotion.textColor: Color
23+
get() = when (this) {
24+
Emotion.WARM -> WarmthTextColor
25+
Emotion.JOY -> JoyTextColor
26+
Emotion.SAD -> SadnessTextColor
27+
Emotion.INSIGHT -> InsightTextColor
28+
}
Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
package com.ninecraft.booket.core.designsystem
22

3-
import androidx.compose.ui.graphics.Color
4-
import com.ninecraft.booket.core.designsystem.theme.JoyBgColor
5-
import com.ninecraft.booket.core.designsystem.theme.JoyTextColor
6-
import com.ninecraft.booket.core.designsystem.theme.SadnessBgColor
7-
import com.ninecraft.booket.core.designsystem.theme.SadnessTextColor
8-
import com.ninecraft.booket.core.designsystem.theme.InsightBgColor
9-
import com.ninecraft.booket.core.designsystem.theme.InsightTextColor
10-
import com.ninecraft.booket.core.designsystem.theme.WarmthBgColor
11-
import com.ninecraft.booket.core.designsystem.theme.WarmthTextColor
12-
13-
enum class EmotionTag(val label: String, val bgColor: Color, val textColor: Color, val graphic: Int) {
14-
WARMTH("따뜻함", WarmthBgColor, WarmthTextColor, R.drawable.img_emotion_warmth),
15-
JOY("즐거움", JoyBgColor, JoyTextColor, R.drawable.img_emotion_joy),
16-
SADNESS("슬픔", SadnessBgColor, SadnessTextColor, R.drawable.img_emotion_sadness),
17-
INSIGHT("깨달음", InsightBgColor, InsightTextColor, R.drawable.img_emotion_insight),
3+
enum class EmotionTag(val label: String, val graphic: Int) {
4+
WARMTH("따뜻함", R.drawable.img_emotion_warmth),
5+
JOY("즐거움", R.drawable.img_emotion_joy),
6+
SADNESS("슬픔", R.drawable.img_emotion_sadness),
7+
INSIGHT("깨달음", R.drawable.img_emotion_insight),
188
}

feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/component/SeedItem.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import androidx.compose.ui.Modifier
1616
import androidx.compose.ui.draw.clip
1717
import androidx.compose.ui.res.painterResource
1818
import androidx.compose.ui.unit.dp
19-
import com.ninecraft.booket.core.common.extensions.toBackgroundColor
20-
import com.ninecraft.booket.core.common.extensions.toTextColor
2119
import com.ninecraft.booket.core.designsystem.ComponentPreview
20+
import com.ninecraft.booket.core.designsystem.bgColor
21+
import com.ninecraft.booket.core.designsystem.textColor
2222
import com.ninecraft.booket.core.designsystem.theme.ReedTheme
2323
import com.ninecraft.booket.core.model.Emotion
2424
import com.ninecraft.booket.core.model.EmotionModel
@@ -42,7 +42,7 @@ internal fun SeedItem(
4242
Box(
4343
modifier = Modifier
4444
.clip(RoundedCornerShape(ReedTheme.radius.full))
45-
.background(emotion.name.toBackgroundColor())
45+
.background(emotion.name.bgColor)
4646
.padding(
4747
horizontal = ReedTheme.spacing.spacing2,
4848
vertical = ReedTheme.spacing.spacing1,
@@ -51,7 +51,7 @@ internal fun SeedItem(
5151
) {
5252
Text(
5353
text = emotion.name.displayName,
54-
color = emotion.name.toTextColor(),
54+
color = emotion.name.textColor,
5555
style = ReedTheme.typography.label2SemiBold,
5656
)
5757
}

0 commit comments

Comments
 (0)