Skip to content

Commit 1d57638

Browse files
authored
Merge pull request #48 from rbqks529/ui/#47-book_search
[UI] 책 검색 페이지 화면 구현
2 parents 23c94fa + 63fccf3 commit 1d57638

25 files changed

Lines changed: 1376 additions & 124 deletions

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.texthip.thip.ui.booksearch.component
2+
3+
import androidx.compose.foundation.layout.Arrangement
4+
import androidx.compose.foundation.layout.Column
5+
import androidx.compose.foundation.layout.Spacer
6+
import androidx.compose.foundation.layout.fillMaxSize
7+
import androidx.compose.foundation.layout.height
8+
import androidx.compose.foundation.layout.padding
9+
import androidx.compose.foundation.layout.width
10+
import androidx.compose.material3.Text
11+
import androidx.compose.runtime.Composable
12+
import androidx.compose.ui.Alignment
13+
import androidx.compose.ui.Modifier
14+
import androidx.compose.ui.res.stringResource
15+
import androidx.compose.ui.unit.dp
16+
import com.texthip.thip.R
17+
import com.texthip.thip.ui.common.buttons.ActionMediumButton
18+
import com.texthip.thip.ui.theme.ThipTheme.colors
19+
import com.texthip.thip.ui.theme.ThipTheme.typography
20+
21+
@Composable
22+
fun BookEmptyResult(
23+
mainText: String,
24+
subText: String,
25+
onRequestBook: () -> Unit
26+
) {
27+
Column(
28+
modifier = Modifier.fillMaxSize(),
29+
verticalArrangement = Arrangement.Center,
30+
horizontalAlignment = Alignment.CenterHorizontally
31+
) {
32+
Text(
33+
text = mainText,
34+
color = colors.White,
35+
style = typography.smalltitle_sb600_s18_h24
36+
)
37+
Text(
38+
text = subText,
39+
modifier = Modifier.padding(top = 8.dp),
40+
color = colors.Grey,
41+
style = typography.copy_r400_s14
42+
)
43+
Spacer(Modifier.height(20.dp))
44+
45+
ActionMediumButton(
46+
text = stringResource(R.string.group_register_book),
47+
contentColor = colors.White,
48+
backgroundColor = colors.Purple,
49+
modifier = Modifier
50+
.width(97.dp)
51+
.height(44.dp),
52+
onClick = { onRequestBook() },
53+
)
54+
}
55+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package com.texthip.thip.ui.booksearch.component
2+
3+
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.layout.*
5+
import androidx.compose.foundation.lazy.LazyColumn
6+
import androidx.compose.foundation.lazy.itemsIndexed
7+
import androidx.compose.material3.Text
8+
import androidx.compose.runtime.Composable
9+
import androidx.compose.ui.Alignment
10+
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.res.stringResource
12+
import androidx.compose.ui.tooling.preview.Preview
13+
import androidx.compose.ui.unit.dp
14+
import com.texthip.thip.R
15+
import com.texthip.thip.ui.booksearch.mock.BookData
16+
import com.texthip.thip.ui.common.cards.CardBookList
17+
import com.texthip.thip.ui.theme.ThipTheme
18+
import com.texthip.thip.ui.theme.ThipTheme.colors
19+
import com.texthip.thip.ui.theme.ThipTheme.typography
20+
21+
@Composable
22+
fun BookFilteredSearchResult(
23+
resultCount: Int,
24+
bookList: List<BookData>
25+
) {
26+
Column {
27+
Row(
28+
modifier = Modifier.fillMaxWidth(),
29+
verticalAlignment = Alignment.CenterVertically
30+
) {
31+
Text(
32+
text = stringResource(R.string.group_searched_room_size, resultCount),
33+
color = colors.Grey,
34+
style = typography.menu_m500_s14_h24
35+
)
36+
}
37+
Spacer(
38+
modifier = Modifier
39+
.padding(top = 4.dp, bottom = 20.dp)
40+
.fillMaxWidth()
41+
.height(1.dp)
42+
.background(colors.DarkGrey02)
43+
)
44+
45+
if (bookList.isEmpty()) {
46+
BookEmptyResult(
47+
mainText = stringResource(R.string.book_no_search_result1),
48+
subText = stringResource(R.string.book_no_search_result2),
49+
onRequestBook = { /*책 요청 처리*/ }
50+
)
51+
} else {
52+
LazyColumn(
53+
verticalArrangement = Arrangement.Center
54+
) {
55+
itemsIndexed(bookList) { index, book ->
56+
CardBookList(
57+
title = book.title,
58+
author = book.author,
59+
publisher = book.publisher,
60+
imageRes = book.imageRes
61+
)
62+
if (index < bookList.size - 1) {
63+
Spacer(
64+
modifier = Modifier
65+
.padding(top = 12.dp, bottom = 12.dp)
66+
.fillMaxWidth()
67+
.height(1.dp)
68+
.background(colors.DarkGrey02)
69+
)
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}
76+
77+
@Preview
78+
@Composable
79+
fun PreviewBookFilteredSearchResult() {
80+
ThipTheme {
81+
BookFilteredSearchResult(
82+
resultCount = 3,
83+
bookList = listOf(
84+
BookData(
85+
title = "이기적 유전자",
86+
author = "리처드 도킨스",
87+
publisher = "을유문화사"
88+
),
89+
BookData(
90+
title = "총, 균, 쇠",
91+
author = "재레드 다이아몬드",
92+
publisher = "문학사상사"
93+
),
94+
BookData(
95+
title = "코스모스",
96+
author = "칼 세이건",
97+
publisher = "사이언스북스"
98+
)
99+
)
100+
)
101+
}
102+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.texthip.thip.ui.booksearch.component
2+
3+
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.layout.Arrangement
5+
import androidx.compose.foundation.layout.Spacer
6+
import androidx.compose.foundation.layout.fillMaxWidth
7+
import androidx.compose.foundation.layout.height
8+
import androidx.compose.foundation.layout.padding
9+
import androidx.compose.foundation.lazy.LazyColumn
10+
import androidx.compose.foundation.lazy.itemsIndexed
11+
import androidx.compose.runtime.Composable
12+
import androidx.compose.ui.Modifier
13+
import androidx.compose.ui.unit.dp
14+
import com.texthip.thip.ui.booksearch.mock.BookData
15+
import com.texthip.thip.ui.common.cards.CardBookList
16+
import com.texthip.thip.ui.theme.ThipTheme.colors
17+
18+
@Composable
19+
fun BookLiveSearchResult(
20+
bookList: List<BookData>
21+
) {
22+
LazyColumn(
23+
verticalArrangement = Arrangement.Center
24+
) {
25+
itemsIndexed(bookList) { index, book ->
26+
CardBookList(
27+
title = book.title,
28+
author = book.author,
29+
publisher = book.publisher,
30+
imageRes = book.imageRes
31+
)
32+
if (index < bookList.size - 1) {
33+
Spacer(
34+
modifier = Modifier
35+
.padding(top = 12.dp, bottom = 12.dp)
36+
.fillMaxWidth()
37+
.height(1.dp)
38+
.background(colors.DarkGrey02)
39+
)
40+
}
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)