Skip to content

Commit 906d4cd

Browse files
committed
[refactor]: GroupSearchScreen의 컴포넌트 분리 및 간결화 (#44)
1 parent f90a225 commit 906d4cd

5 files changed

Lines changed: 244 additions & 174 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.texthip.thip.ui.group.myroom.screen
2+
3+
import androidx.compose.foundation.layout.*
4+
import androidx.compose.material3.Text
5+
import androidx.compose.runtime.Composable
6+
import androidx.compose.ui.Alignment
7+
import androidx.compose.ui.Modifier
8+
import androidx.compose.ui.unit.dp
9+
import com.texthip.thip.ui.theme.ThipTheme
10+
11+
@Composable
12+
fun GroupEmptyResultScreen(
13+
mainText: String,
14+
subText: String
15+
) {
16+
val colors = ThipTheme.colors
17+
val typography = ThipTheme.typography
18+
Column(
19+
modifier = Modifier.fillMaxSize(),
20+
verticalArrangement = Arrangement.Center,
21+
horizontalAlignment = Alignment.CenterHorizontally
22+
) {
23+
Text(
24+
text = mainText,
25+
modifier = Modifier.padding(top = 20.dp),
26+
color = colors.White,
27+
style = typography.smalltitle_sb600_s18_h24
28+
)
29+
Text(
30+
text = subText,
31+
modifier = Modifier.padding(top = 8.dp),
32+
color = colors.Grey,
33+
style = typography.copy_r400_s14
34+
)
35+
}
36+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package com.texthip.thip.ui.group.myroom.screen
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.Row
7+
import androidx.compose.foundation.layout.Spacer
8+
import androidx.compose.foundation.layout.fillMaxWidth
9+
import androidx.compose.foundation.layout.height
10+
import androidx.compose.foundation.layout.padding
11+
import androidx.compose.foundation.layout.width
12+
import androidx.compose.material3.Text
13+
import androidx.compose.runtime.Composable
14+
import androidx.compose.ui.Alignment
15+
import androidx.compose.ui.Modifier
16+
import androidx.compose.ui.res.stringResource
17+
import androidx.compose.ui.unit.dp
18+
import com.texthip.thip.R
19+
import com.texthip.thip.ui.common.buttons.GenreChipRow
20+
import com.texthip.thip.ui.common.cards.CardItemRoomSmall
21+
import com.texthip.thip.ui.group.myroom.mock.GroupCardItemRoomData
22+
import com.texthip.thip.ui.theme.ThipTheme
23+
24+
@Composable
25+
fun GroupFilteredSearchResultScreen(
26+
genres: List<String>,
27+
selectedGenreIndex: Int,
28+
onGenreSelect: (Int) -> Unit,
29+
resultCount: Int,
30+
roomList: List<GroupCardItemRoomData>
31+
) {
32+
val colors = ThipTheme.colors
33+
val typography = ThipTheme.typography
34+
GenreChipRow(
35+
modifier = Modifier.width(20.dp),
36+
genres = genres,
37+
selectedIndex = selectedGenreIndex,
38+
onSelect = onGenreSelect
39+
)
40+
Spacer(modifier = Modifier.height(20.dp))
41+
42+
Row(
43+
modifier = Modifier.fillMaxWidth(),
44+
verticalAlignment = Alignment.CenterVertically
45+
) {
46+
Text(
47+
text = stringResource(R.string.group_searched_room_size, resultCount),
48+
color = colors.Grey,
49+
style = typography.menu_m500_s14_h24
50+
)
51+
}
52+
Spacer(
53+
modifier = Modifier
54+
.padding(top = 4.dp, bottom = 8.dp)
55+
.fillMaxWidth()
56+
.height(1.dp)
57+
.background(colors.DarkGrey02)
58+
)
59+
if (roomList.isEmpty()) {
60+
GroupEmptyResultScreen(
61+
mainText = stringResource(R.string.group_no_search_result1),
62+
subText = stringResource(R.string.group_no_search_result2)
63+
)
64+
} else {
65+
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
66+
roomList.forEach { room ->
67+
CardItemRoomSmall(
68+
title = room.title,
69+
participants = room.participants,
70+
maxParticipants = room.maxParticipants,
71+
endDate = room.endDate,
72+
imageRes = room.imageRes,
73+
isWide = true,
74+
isSecret = room.isSecret
75+
)
76+
Spacer(
77+
modifier = Modifier
78+
.fillMaxWidth()
79+
.height(1.dp)
80+
.background(colors.DarkGrey02)
81+
)
82+
}
83+
}
84+
}
85+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.texthip.thip.ui.group.myroom.screen
2+
3+
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.layout.*
5+
import androidx.compose.runtime.Composable
6+
import androidx.compose.ui.Modifier
7+
import androidx.compose.ui.unit.dp
8+
import com.texthip.thip.ui.common.cards.CardItemRoomSmall
9+
import com.texthip.thip.ui.group.myroom.mock.GroupCardItemRoomData
10+
import com.texthip.thip.ui.theme.ThipTheme
11+
12+
@Composable
13+
fun GroupLiveSearchResultScreen(
14+
roomList: List<GroupCardItemRoomData>
15+
) {
16+
val colors = ThipTheme.colors
17+
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
18+
roomList.forEach { room ->
19+
CardItemRoomSmall(
20+
title = room.title,
21+
participants = room.participants,
22+
maxParticipants = room.maxParticipants,
23+
endDate = room.endDate,
24+
imageRes = room.imageRes,
25+
isWide = true,
26+
isSecret = room.isSecret
27+
)
28+
Spacer(
29+
modifier = Modifier
30+
.fillMaxWidth()
31+
.height(1.dp)
32+
.background(colors.DarkGrey02)
33+
)
34+
}
35+
}
36+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.texthip.thip.ui.group.myroom.screen
2+
3+
import androidx.compose.foundation.layout.*
4+
import androidx.compose.material3.Text
5+
import androidx.compose.runtime.Composable
6+
import androidx.compose.ui.Modifier
7+
import androidx.compose.ui.res.stringResource
8+
import androidx.compose.ui.unit.dp
9+
import com.texthip.thip.R
10+
import com.texthip.thip.ui.common.buttons.GenreChipButton
11+
import com.texthip.thip.ui.theme.ThipTheme
12+
import androidx.compose.foundation.layout.FlowRow
13+
14+
@Composable
15+
fun GroupRecentSearchScreen(
16+
recentSearches: List<String>,
17+
onSearchClick: (String) -> Unit,
18+
onRemove: (String) -> Unit
19+
) {
20+
val colors = ThipTheme.colors
21+
val typography = ThipTheme.typography
22+
Text(
23+
text = stringResource(R.string.group_recent_search),
24+
color = colors.White,
25+
style = typography.menu_r400_s14_h24
26+
)
27+
Spacer(modifier = Modifier.height(16.dp))
28+
if (recentSearches.isEmpty()) {
29+
Text(
30+
text = stringResource(R.string.group_no_recent_search),
31+
color = colors.Grey01,
32+
style = typography.menu_r400_s14_h24
33+
)
34+
} else {
35+
FlowRow(
36+
verticalArrangement = Arrangement.spacedBy(12.dp),
37+
horizontalArrangement = Arrangement.spacedBy(16.dp),
38+
maxLines = 2,
39+
) {
40+
recentSearches.take(9).forEach { keyword ->
41+
GenreChipButton(
42+
text = keyword,
43+
onClick = { onSearchClick(keyword) },
44+
onCloseClick = { onRemove(keyword) }
45+
)
46+
}
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)