Skip to content

Commit 4215a8d

Browse files
committed
Refactor: RecommendRoutineItem 컴포넌트 리디자인 반영
1 parent 9437af3 commit 4215a8d

1 file changed

Lines changed: 89 additions & 31 deletions

File tree

  • presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/component/block

presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/component/block/RecommendRoutineItem.kt

Lines changed: 89 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,78 +4,136 @@ import androidx.compose.foundation.background
44
import androidx.compose.foundation.layout.Arrangement
55
import androidx.compose.foundation.layout.Column
66
import androidx.compose.foundation.layout.Row
7+
import androidx.compose.foundation.layout.Spacer
78
import androidx.compose.foundation.layout.fillMaxWidth
8-
import androidx.compose.foundation.layout.height
99
import androidx.compose.foundation.layout.padding
1010
import androidx.compose.foundation.layout.size
1111
import androidx.compose.foundation.shape.RoundedCornerShape
12+
import androidx.compose.material3.HorizontalDivider
1213
import androidx.compose.material3.Text
1314
import androidx.compose.runtime.Composable
1415
import androidx.compose.ui.Alignment
1516
import androidx.compose.ui.Modifier
16-
import androidx.compose.ui.text.style.TextOverflow.Companion.Ellipsis
1717
import androidx.compose.ui.tooling.preview.Preview
1818
import androidx.compose.ui.unit.dp
1919
import com.threegap.bitnagil.designsystem.BitnagilTheme
2020
import com.threegap.bitnagil.designsystem.R
2121
import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon
2222
import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple
23+
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory
24+
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendLevel
25+
import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendRoutineUiModel
26+
import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendSubRoutineUiModel
2327

2428
@Composable
2529
fun RecommendRoutineItem(
26-
routineName: String,
27-
routineDescription: String,
30+
routine: RecommendRoutineUiModel,
2831
onAddRoutineClick: () -> Unit,
2932
modifier: Modifier = Modifier,
3033
) {
31-
Row(
32-
verticalAlignment = Alignment.CenterVertically,
34+
Column(
3335
modifier = modifier
34-
.height(80.dp)
35-
.fillMaxWidth()
3636
.background(
37-
color = BitnagilTheme.colors.lightBlue75,
37+
color = BitnagilTheme.colors.white,
3838
shape = RoundedCornerShape(12.dp),
3939
)
4040
.clickableWithoutRipple(onClick = onAddRoutineClick)
41-
.padding(
42-
vertical = 16.dp,
43-
horizontal = 20.dp,
44-
),
41+
.fillMaxWidth()
42+
.padding(vertical = 14.dp),
4543
) {
46-
Column(
47-
verticalArrangement = Arrangement.spacedBy(4.dp),
48-
modifier = Modifier.weight(1f),
44+
Row(
45+
modifier = Modifier
46+
.padding(start = 16.dp, end = 11.dp),
47+
verticalAlignment = Alignment.CenterVertically,
4948
) {
49+
BitnagilIcon(
50+
id = routine.icon,
51+
tint = null,
52+
modifier = Modifier
53+
.background(
54+
color = routine.color,
55+
shape = RoundedCornerShape(4.dp),
56+
)
57+
.padding(4.dp),
58+
)
59+
5060
Text(
51-
text = routineName,
52-
color = BitnagilTheme.colors.navy500,
61+
text = routine.name,
62+
color = BitnagilTheme.colors.coolGray10,
5363
style = BitnagilTheme.typography.body1SemiBold,
64+
modifier = Modifier.padding(start = 10.dp),
5465
)
5566

56-
Text(
57-
text = routineDescription,
58-
color = BitnagilTheme.colors.navy300,
59-
style = BitnagilTheme.typography.body2Regular,
60-
maxLines = 1,
61-
overflow = Ellipsis,
67+
Spacer(modifier = Modifier.weight(1f))
68+
69+
BitnagilIcon(
70+
id = R.drawable.ic_add,
71+
tint = BitnagilTheme.colors.coolGray10,
72+
modifier = Modifier.size(24.dp),
6273
)
6374
}
6475

65-
BitnagilIcon(
66-
id = R.drawable.ic_plus,
67-
tint = BitnagilTheme.colors.navy400,
68-
modifier = Modifier.size(32.dp),
69-
)
76+
if (routine.recommendSubRoutines.isNotEmpty()) {
77+
HorizontalDivider(
78+
thickness = 1.dp,
79+
color = BitnagilTheme.colors.coolGray97,
80+
modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp),
81+
)
82+
83+
Column(
84+
modifier = Modifier
85+
.padding(horizontal = 16.dp),
86+
verticalArrangement = Arrangement.spacedBy(2.dp),
87+
) {
88+
Text(
89+
text = "세부 루틴",
90+
color = BitnagilTheme.colors.coolGray40,
91+
style = BitnagilTheme.typography.body2Medium,
92+
)
93+
94+
routine.recommendSubRoutines.forEach { subRoutine ->
95+
Text(
96+
text = "${subRoutine.name}",
97+
color = BitnagilTheme.colors.coolGray40,
98+
style = BitnagilTheme.typography.body2Medium,
99+
)
100+
}
101+
}
102+
}
70103
}
71104
}
72105

73106
@Preview
74107
@Composable
75108
private fun RecommendRoutineItemPreview() {
76109
RecommendRoutineItem(
77-
routineName = "쓰레기 버리러 나가기",
78-
routineDescription = "간단한 외출도 의미있는 변화예요.",
110+
routine = RecommendRoutineUiModel(
111+
id = 1,
112+
name = "개운하게 일어나기",
113+
level = RecommendLevel.LEVEL1,
114+
recommendedRoutineType = RecommendCategory.WAKE_UP,
115+
recommendSubRoutines = listOf(
116+
RecommendSubRoutineUiModel(
117+
id = 1,
118+
name = "일어나기",
119+
),
120+
),
121+
),
122+
onAddRoutineClick = {},
123+
)
124+
}
125+
126+
@Preview
127+
@Composable
128+
private fun EmptySubRoutineRecommendRoutineItemPreview() {
129+
RecommendRoutineItem(
130+
routine = RecommendRoutineUiModel(
131+
id = 1,
132+
name = "개운하게 일어나기",
133+
level = RecommendLevel.LEVEL1,
134+
recommendedRoutineType = RecommendCategory.WAKE_UP,
135+
recommendSubRoutines = emptyList(),
136+
),
79137
onAddRoutineClick = {},
80138
)
81139
}

0 commit comments

Comments
 (0)