@@ -4,78 +4,136 @@ import androidx.compose.foundation.background
44import androidx.compose.foundation.layout.Arrangement
55import androidx.compose.foundation.layout.Column
66import androidx.compose.foundation.layout.Row
7+ import androidx.compose.foundation.layout.Spacer
78import androidx.compose.foundation.layout.fillMaxWidth
8- import androidx.compose.foundation.layout.height
99import androidx.compose.foundation.layout.padding
1010import androidx.compose.foundation.layout.size
1111import androidx.compose.foundation.shape.RoundedCornerShape
12+ import androidx.compose.material3.HorizontalDivider
1213import androidx.compose.material3.Text
1314import androidx.compose.runtime.Composable
1415import androidx.compose.ui.Alignment
1516import androidx.compose.ui.Modifier
16- import androidx.compose.ui.text.style.TextOverflow.Companion.Ellipsis
1717import androidx.compose.ui.tooling.preview.Preview
1818import androidx.compose.ui.unit.dp
1919import com.threegap.bitnagil.designsystem.BitnagilTheme
2020import com.threegap.bitnagil.designsystem.R
2121import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon
2222import 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
2529fun 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
75108private 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