Skip to content

Commit 73d60bb

Browse files
committed
[refactor]: 기존 Group 검색 컴포넌트 이름 및 divider 수정 (#47)
1 parent 6032cbe commit 73d60bb

6 files changed

Lines changed: 42 additions & 40 deletions

File tree

app/src/main/java/com/texthip/thip/ui/group/myroom/screen/GroupEmptyResultScreen.kt renamed to app/src/main/java/com/texthip/thip/ui/group/myroom/component/GroupEmptyResult.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.texthip.thip.ui.group.myroom.screen
1+
package com.texthip.thip.ui.group.myroom.component
22

33
import androidx.compose.foundation.layout.Arrangement
44
import androidx.compose.foundation.layout.Column
@@ -12,7 +12,7 @@ import androidx.compose.ui.unit.dp
1212
import com.texthip.thip.ui.theme.ThipTheme
1313

1414
@Composable
15-
fun GroupEmptyResultScreen(
15+
fun GroupEmptyResult(
1616
mainText: String,
1717
subText: String
1818
) {

app/src/main/java/com/texthip/thip/ui/group/myroom/screen/GroupFilteredSearchResultScreen.kt renamed to app/src/main/java/com/texthip/thip/ui/group/myroom/component/GroupFilteredSearchResult.kt

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
package com.texthip.thip.ui.group.myroom.screen
1+
package com.texthip.thip.ui.group.myroom.component
22

33
import androidx.compose.foundation.background
4-
import androidx.compose.foundation.layout.Arrangement
5-
import androidx.compose.foundation.layout.Row
6-
import androidx.compose.foundation.layout.Spacer
7-
import androidx.compose.foundation.layout.fillMaxWidth
8-
import androidx.compose.foundation.layout.height
9-
import androidx.compose.foundation.layout.padding
10-
import androidx.compose.foundation.layout.width
4+
import androidx.compose.foundation.layout.*
115
import androidx.compose.foundation.lazy.LazyColumn
12-
import androidx.compose.foundation.lazy.items
6+
import androidx.compose.foundation.lazy.itemsIndexed
137
import androidx.compose.material3.Text
148
import androidx.compose.runtime.Composable
159
import androidx.compose.ui.Alignment
@@ -23,7 +17,7 @@ import com.texthip.thip.ui.group.myroom.mock.GroupCardItemRoomData
2317
import com.texthip.thip.ui.theme.ThipTheme
2418

2519
@Composable
26-
fun GroupFilteredSearchResultScreen(
20+
fun GroupFilteredSearchResult(
2721
genres: List<String>,
2822
selectedGenreIndex: Int,
2923
onGenreSelect: (Int) -> Unit,
@@ -32,6 +26,7 @@ fun GroupFilteredSearchResultScreen(
3226
) {
3327
val colors = ThipTheme.colors
3428
val typography = ThipTheme.typography
29+
3530
GenreChipRow(
3631
modifier = Modifier.width(20.dp),
3732
genres = genres,
@@ -57,16 +52,17 @@ fun GroupFilteredSearchResultScreen(
5752
.height(1.dp)
5853
.background(colors.DarkGrey02)
5954
)
55+
6056
if (roomList.isEmpty()) {
61-
GroupEmptyResultScreen(
57+
GroupEmptyResult(
6258
mainText = stringResource(R.string.group_no_search_result1),
6359
subText = stringResource(R.string.group_no_search_result2)
6460
)
6561
} else {
6662
LazyColumn(
6763
verticalArrangement = Arrangement.spacedBy(16.dp)
6864
) {
69-
items(roomList) { room ->
65+
itemsIndexed(roomList) { index, room ->
7066
CardItemRoomSmall(
7167
title = room.title,
7268
participants = room.participants,
@@ -76,13 +72,16 @@ fun GroupFilteredSearchResultScreen(
7672
isWide = true,
7773
isSecret = room.isSecret
7874
)
79-
Spacer(
80-
modifier = Modifier
81-
.fillMaxWidth()
82-
.height(1.dp)
83-
.background(colors.DarkGrey02)
84-
)
75+
if (index < roomList.size - 1) {
76+
Spacer(
77+
modifier = Modifier
78+
.fillMaxWidth()
79+
.height(1.dp)
80+
.background(colors.DarkGrey02)
81+
)
82+
}
8583
}
8684
}
8785
}
8886
}
87+

app/src/main/java/com/texthip/thip/ui/group/myroom/screen/GroupLiveSearchResultScreen.kt renamed to app/src/main/java/com/texthip/thip/ui/group/myroom/component/GroupLiveSearchResult.kt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package com.texthip.thip.ui.group.myroom.screen
1+
package com.texthip.thip.ui.group.myroom.component
22

33
import androidx.compose.foundation.background
44
import androidx.compose.foundation.layout.Arrangement
55
import androidx.compose.foundation.layout.Spacer
66
import androidx.compose.foundation.layout.fillMaxWidth
77
import androidx.compose.foundation.layout.height
88
import androidx.compose.foundation.lazy.LazyColumn
9-
import androidx.compose.foundation.lazy.items
9+
import androidx.compose.foundation.lazy.itemsIndexed
1010
import androidx.compose.runtime.Composable
1111
import androidx.compose.ui.Modifier
1212
import androidx.compose.ui.unit.dp
@@ -15,13 +15,13 @@ import com.texthip.thip.ui.group.myroom.mock.GroupCardItemRoomData
1515
import com.texthip.thip.ui.theme.ThipTheme.colors
1616

1717
@Composable
18-
fun GroupLiveSearchResultScreen(
18+
fun GroupLiveSearchResult(
1919
roomList: List<GroupCardItemRoomData>
2020
) {
2121
LazyColumn(
2222
verticalArrangement = Arrangement.spacedBy(16.dp)
2323
) {
24-
items(roomList) { room ->
24+
itemsIndexed(roomList) { index, room ->
2525
CardItemRoomSmall(
2626
title = room.title,
2727
participants = room.participants,
@@ -31,12 +31,14 @@ fun GroupLiveSearchResultScreen(
3131
isWide = true,
3232
isSecret = room.isSecret
3333
)
34-
Spacer(
35-
modifier = Modifier
36-
.fillMaxWidth()
37-
.height(1.dp)
38-
.background(colors.DarkGrey02)
39-
)
34+
if (index < roomList.size - 1) {
35+
Spacer(
36+
modifier = Modifier
37+
.fillMaxWidth()
38+
.height(1.dp)
39+
.background(colors.DarkGrey02)
40+
)
41+
}
4042
}
4143
}
4244
}

app/src/main/java/com/texthip/thip/ui/group/myroom/screen/GroupRecentSearchScreen.kt renamed to app/src/main/java/com/texthip/thip/ui/group/myroom/component/GroupRecentSearch.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.texthip.thip.ui.group.myroom.screen
1+
package com.texthip.thip.ui.group.myroom.component
22

33
import androidx.compose.foundation.layout.Arrangement
44
import androidx.compose.material3.Text
@@ -14,7 +14,7 @@ import androidx.compose.foundation.layout.Spacer
1414
import androidx.compose.foundation.layout.height
1515

1616
@Composable
17-
fun GroupRecentSearchScreen(
17+
fun GroupRecentSearch(
1818
recentSearches: List<String>,
1919
onSearchClick: (String) -> Unit,
2020
onRemove: (String) -> Unit

app/src/main/java/com/texthip/thip/ui/group/myroom/screen/GroupSearchScreen.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import com.texthip.thip.R
2828
import com.texthip.thip.ui.common.buttons.FilterButton
2929
import com.texthip.thip.ui.common.forms.SearchBookTextField
3030
import com.texthip.thip.ui.common.topappbar.DefaultTopAppBar
31+
import com.texthip.thip.ui.group.myroom.component.GroupEmptyResult
32+
import com.texthip.thip.ui.group.myroom.component.GroupFilteredSearchResult
33+
import com.texthip.thip.ui.group.myroom.component.GroupLiveSearchResult
34+
import com.texthip.thip.ui.group.myroom.component.GroupRecentSearch
3135
import com.texthip.thip.ui.group.myroom.mock.GroupCardItemRoomData
3236
import com.texthip.thip.ui.theme.ThipTheme
3337

@@ -132,14 +136,14 @@ fun GroupSearchScreen(
132136

133137
when {
134138
searchText.isBlank() && !isSearched && recentSearches.isEmpty() -> {
135-
GroupRecentSearchScreen(
139+
GroupRecentSearch(
136140
recentSearches = emptyList(),
137141
onSearchClick = {},
138142
onRemove = {}
139143
)
140144
}
141145
searchText.isBlank() && !isSearched && recentSearches.isNotEmpty() -> {
142-
GroupRecentSearchScreen(
146+
GroupRecentSearch(
143147
recentSearches = recentSearches,
144148
onSearchClick = { keyword ->
145149
searchText = keyword
@@ -152,18 +156,18 @@ fun GroupSearchScreen(
152156
}
153157
searchText.isNotBlank() && !isSearched -> {
154158
if (liveFilteredRoomList.isEmpty()) {
155-
GroupEmptyResultScreen(
159+
GroupEmptyResult(
156160
mainText = stringResource(R.string.group_no_search_result1),
157161
subText = stringResource(R.string.group_no_search_result2)
158162
)
159163
} else {
160-
GroupLiveSearchResultScreen(
164+
GroupLiveSearchResult(
161165
roomList = liveFilteredRoomList
162166
)
163167
}
164168
}
165169
isSearched -> {
166-
GroupFilteredSearchResultScreen(
170+
GroupFilteredSearchResult(
167171
genres = genres,
168172
selectedGenreIndex = selectedGenreIndex,
169173
onGenreSelect = { selectedGenreIndex = it },

app/src/main/java/com/texthip/thip/ui/group/screen/GroupScreen.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.texthip.thip.ui.group.screen
22

33
import androidx.compose.foundation.background
4-
import androidx.compose.foundation.layout.Arrangement
54
import androidx.compose.foundation.layout.Box
65
import androidx.compose.foundation.layout.Column
76
import androidx.compose.foundation.layout.Spacer
87
import androidx.compose.foundation.layout.fillMaxSize
98
import androidx.compose.foundation.layout.fillMaxWidth
109
import androidx.compose.foundation.layout.height
11-
import androidx.compose.foundation.layout.padding
1210
import androidx.compose.foundation.rememberScrollState
1311
import androidx.compose.foundation.verticalScroll
1412
import androidx.compose.runtime.Composable
@@ -34,7 +32,6 @@ import com.texthip.thip.ui.group.myroom.mock.GroupViewModel
3432
import com.texthip.thip.ui.theme.ThipTheme
3533
import com.texthip.thip.ui.theme.ThipTheme.colors
3634

37-
3835
@Composable
3936
fun GroupScreen(
4037
navController: NavHostController? = null,

0 commit comments

Comments
 (0)