Skip to content

Commit 97d3ff3

Browse files
committed
Feat: RoutineDetailsCard 컴포넌트 구현
1 parent 43a7219 commit 97d3ff3

1 file changed

Lines changed: 155 additions & 0 deletions

File tree

  • presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/component/template
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
package com.threegap.bitnagil.presentation.routinelist.component.template
2+
3+
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.layout.Arrangement
5+
import androidx.compose.foundation.layout.Column
6+
import androidx.compose.foundation.layout.PaddingValues
7+
import androidx.compose.foundation.layout.Row
8+
import androidx.compose.foundation.layout.Spacer
9+
import androidx.compose.foundation.layout.fillMaxWidth
10+
import androidx.compose.foundation.layout.padding
11+
import androidx.compose.foundation.shape.RoundedCornerShape
12+
import androidx.compose.material3.HorizontalDivider
13+
import androidx.compose.material3.Text
14+
import androidx.compose.runtime.Composable
15+
import androidx.compose.ui.Alignment
16+
import androidx.compose.ui.Modifier
17+
import androidx.compose.ui.tooling.preview.Preview
18+
import androidx.compose.ui.unit.dp
19+
import com.threegap.bitnagil.designsystem.BitnagilTheme
20+
import com.threegap.bitnagil.designsystem.R
21+
import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon
22+
import com.threegap.bitnagil.designsystem.component.atom.BitnagilIconButton
23+
import com.threegap.bitnagil.domain.routine.model.DayOfWeek
24+
import com.threegap.bitnagil.domain.routine.model.DayOfWeek.Companion.formatRepeatDays
25+
import com.threegap.bitnagil.presentation.routinelist.model.RoutineUiModel
26+
27+
@Composable
28+
fun RoutineDetailsCard(
29+
routine: RoutineUiModel,
30+
onDeleteClick: () -> Unit,
31+
modifier: Modifier = Modifier,
32+
) {
33+
Column(
34+
modifier = modifier
35+
.background(
36+
color = BitnagilTheme.colors.white,
37+
shape = RoundedCornerShape(12.dp),
38+
)
39+
.fillMaxWidth()
40+
.padding(vertical = 14.dp),
41+
) {
42+
Row(
43+
modifier = Modifier
44+
.padding(start = 16.dp, end = 2.dp),
45+
verticalAlignment = Alignment.CenterVertically,
46+
) {
47+
BitnagilIcon(
48+
id = R.drawable.ic_check_circle_orange,
49+
tint = null,
50+
modifier = Modifier
51+
.background(
52+
color = BitnagilTheme.colors.orange25,
53+
shape = RoundedCornerShape(4.dp),
54+
)
55+
.padding(4.dp),
56+
)
57+
58+
Text(
59+
text = routine.routineName,
60+
color = BitnagilTheme.colors.coolGray10,
61+
style = BitnagilTheme.typography.body1SemiBold,
62+
modifier = Modifier.padding(start = 10.dp),
63+
)
64+
65+
Spacer(modifier = Modifier.weight(1f))
66+
67+
BitnagilIconButton(
68+
id = R.drawable.ic_edit,
69+
onClick = { /*TODO*/ },
70+
tint = null,
71+
paddingValues = PaddingValues(12.dp),
72+
)
73+
74+
BitnagilIconButton(
75+
id = R.drawable.ic_trash,
76+
onClick = onDeleteClick,
77+
tint = null,
78+
paddingValues = PaddingValues(12.dp),
79+
)
80+
}
81+
82+
if (routine.subRoutineNames.isNotEmpty()) {
83+
HorizontalDivider(
84+
thickness = 1.dp,
85+
color = BitnagilTheme.colors.coolGray97,
86+
modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp),
87+
)
88+
89+
Column(
90+
modifier = Modifier
91+
.padding(horizontal = 16.dp),
92+
verticalArrangement = Arrangement.spacedBy(2.dp),
93+
) {
94+
Text(
95+
text = "세부 루틴",
96+
color = BitnagilTheme.colors.coolGray40,
97+
style = BitnagilTheme.typography.body2Medium,
98+
)
99+
100+
routine.subRoutineNames.forEach { name ->
101+
Text(
102+
text = "$name",
103+
color = BitnagilTheme.colors.coolGray40,
104+
style = BitnagilTheme.typography.body2Medium,
105+
)
106+
}
107+
}
108+
}
109+
110+
HorizontalDivider(
111+
thickness = 1.dp,
112+
color = BitnagilTheme.colors.coolGray97,
113+
modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp),
114+
)
115+
116+
Column(
117+
modifier = Modifier
118+
.padding(horizontal = 16.dp),
119+
verticalArrangement = Arrangement.spacedBy(2.dp),
120+
) {
121+
Text(
122+
text = "반복: ${routine.repeatDay.formatRepeatDays()}",
123+
color = BitnagilTheme.colors.coolGray40,
124+
style = BitnagilTheme.typography.body2Medium,
125+
)
126+
Text(
127+
text = "기간: ",
128+
color = BitnagilTheme.colors.coolGray40,
129+
style = BitnagilTheme.typography.body2Medium,
130+
)
131+
Text(
132+
text = "시간: ${routine.executionTime}",
133+
color = BitnagilTheme.colors.coolGray40,
134+
style = BitnagilTheme.typography.body2Medium,
135+
)
136+
}
137+
}
138+
}
139+
140+
@Preview
141+
@Composable
142+
private fun RoutineDetailsCardPreview() {
143+
RoutineDetailsCard(
144+
routine = RoutineUiModel(
145+
routineId = "1",
146+
routineName = "야무진 루틴",
147+
repeatDay = listOf(DayOfWeek.MONDAY, DayOfWeek.TUESDAY),
148+
executionTime = "12:00:00",
149+
routineDate = "2025-08-15",
150+
subRoutineNames = listOf("어쩌구", "저쩌구", "얼씨구"),
151+
recommendedRoutineType = null
152+
),
153+
onDeleteClick = {},
154+
)
155+
}

0 commit comments

Comments
 (0)