1
1
package com.kuit.ourmenu.ui.addmenu.screen
2
2
3
+ import androidx.compose.foundation.layout.Arrangement
3
4
import androidx.compose.foundation.layout.Column
4
5
import androidx.compose.foundation.layout.fillMaxSize
5
6
import androidx.compose.foundation.layout.fillMaxWidth
6
7
import androidx.compose.foundation.layout.padding
8
+ import androidx.compose.foundation.layout.size
9
+ import androidx.compose.foundation.lazy.LazyColumn
10
+ import androidx.compose.foundation.lazy.items
11
+ import androidx.compose.foundation.shape.RoundedCornerShape
7
12
import androidx.compose.material3.Button
13
+ import androidx.compose.material3.ButtonDefaults
8
14
import androidx.compose.material3.ExperimentalMaterial3Api
9
15
import androidx.compose.material3.Icon
10
- import androidx.compose.material3.IconButton
11
16
import androidx.compose.material3.Scaffold
12
17
import androidx.compose.material3.Text
13
- import androidx.compose.material3.TopAppBar
14
18
import androidx.compose.runtime.Composable
19
+ import androidx.compose.runtime.getValue
20
+ import androidx.compose.runtime.mutableStateOf
21
+ import androidx.compose.runtime.saveable.rememberSaveable
15
22
import androidx.compose.ui.Alignment
16
23
import androidx.compose.ui.Modifier
17
- import androidx.compose.ui.draw.drawBehind
18
24
import androidx.compose.ui.draw.shadow
19
25
import androidx.compose.ui.graphics.Color
20
26
import androidx.compose.ui.res.painterResource
21
27
import androidx.compose.ui.text.font.FontWeight
22
28
import androidx.compose.ui.tooling.preview.Preview
23
29
import androidx.compose.ui.unit.dp
30
+ import androidx.compose.ui.unit.sp
24
31
import com.kuit.ourmenu.R
32
+ import com.kuit.ourmenu.ui.addmenu.component.AddMenuTopAppBar
33
+ import com.kuit.ourmenu.ui.addmenu.component.RestaurantSearchItem
34
+ import com.kuit.ourmenu.ui.common.SearchBar
25
35
26
36
@OptIn(ExperimentalMaterial3Api ::class )
27
37
@Composable
28
38
fun AddMenuSearchScreen (modifier : Modifier = Modifier ) {
39
+ val searchActionDone by rememberSaveable { mutableStateOf(true ) }
40
+ val dummyRecentSearchList = mutableListOf (
41
+ false ,
42
+ false ,
43
+ false ,
44
+ false ,
45
+ true ,
46
+ )
47
+ val dummySearchResultList: MutableList <Boolean > = mutableListOf ()
48
+
29
49
Scaffold (modifier = Modifier .fillMaxSize(),
30
50
topBar = {
31
- TopAppBar (
32
- title = {
33
- Text (
34
- " OURMENU" ,
35
- color = Color (0xFFFF5420 ),
36
- fontWeight = FontWeight .Bold
37
- )
38
- },
39
- navigationIcon = {
40
- IconButton (onClick = { TODO (" 뒤로가기 구현" ) }) {
41
- Icon (
42
- painter = painterResource(R .drawable.ic_top_bar_back),
43
- contentDescription = " Back"
44
- )
45
- }
46
- },
47
- modifier = Modifier
48
- .drawBehind {
49
- drawRect(
50
- color = Color .Black
51
- )
52
- }
53
- .shadow(elevation = 4 .dp)
54
- )
51
+ AddMenuTopAppBar {
52
+ Text (
53
+ " OURMENU" ,
54
+ color = Color (0xFFFF5420 ),
55
+ fontWeight = FontWeight .Bold
56
+ )
57
+ }
55
58
},
56
59
bottomBar = {
57
60
Column (
58
61
modifier = Modifier
59
62
.fillMaxWidth()
60
63
.padding(start = 20 .dp, end = 20 .dp, bottom = 20 .dp),
61
- horizontalAlignment = Alignment .CenterHorizontally
64
+ horizontalAlignment = Alignment .CenterHorizontally ,
65
+ verticalArrangement = Arrangement .Center
62
66
) {
63
- Button (onClick = { /* TODO*/ }) {
64
- Text (" 가게와 메뉴 직접 추가하기" )
67
+ Button (
68
+ onClick = { /* TODO*/ },
69
+ modifier = Modifier
70
+ .fillMaxWidth()
71
+ .size(320 .dp, 52 .dp)
72
+ .shadow(elevation = 4 .dp, shape = RoundedCornerShape (12 .dp)),
73
+ shape = RoundedCornerShape (12 .dp),
74
+ colors = ButtonDefaults .buttonColors(
75
+ containerColor = Color (0xFFF7F7F9 ),
76
+ contentColor = Color (0xFFA4A4A6 )
77
+ ),
78
+ ) {
79
+ Text (text = " 가게와 메뉴 직접 추가하기" )
65
80
}
66
81
}
67
82
},
@@ -72,7 +87,62 @@ fun AddMenuSearchScreen(modifier: Modifier = Modifier) {
72
87
.fillMaxWidth(),
73
88
horizontalAlignment = Alignment .CenterHorizontally
74
89
) {
75
- Text (" content" )
90
+ Column (
91
+ modifier = Modifier
92
+ .fillMaxWidth()
93
+ .padding(vertical = 12 .dp, horizontal = 20 .dp)
94
+ ) {
95
+ SearchBar { TODO () }
96
+ }
97
+ Column (modifier = Modifier .fillMaxSize()) {
98
+ if (searchActionDone) {
99
+ // 검색을 한 경우
100
+ if (dummySearchResultList.isEmpty()) {
101
+ Column (
102
+ modifier = Modifier
103
+ .fillMaxWidth()
104
+ .padding(top = 64 .dp),
105
+ horizontalAlignment = Alignment .CenterHorizontally
106
+ ) {
107
+ Icon (
108
+ painter = painterResource(R .drawable.ic_addmenu_noresult),
109
+ contentDescription = " no result" ,
110
+ tint = Color .Unspecified
111
+ )
112
+ Text (
113
+ text = " 검색 결과가 없어요!" ,
114
+ fontSize = 14 .sp,
115
+ color = Color (0xFF666668 ),
116
+ modifier = Modifier .padding(top = 8 .dp)
117
+ )
118
+ }
119
+ } else {
120
+ LazyColumn {
121
+ items(dummySearchResultList) { item ->
122
+ RestaurantSearchItem (item)
123
+ }
124
+ }
125
+ }
126
+ } else {
127
+ // 검색을 하지 않은 경우
128
+ Text (
129
+ text = " 최근 검색" ,
130
+ fontSize = 14 .sp,
131
+ color = Color (0xFF666668 ),
132
+ modifier = Modifier .padding(start = 28 .dp)
133
+ )
134
+ if (dummyRecentSearchList.isEmpty()) {
135
+ Column (modifier = Modifier .fillMaxSize()) { /* empty view*/ }
136
+ } else {
137
+ LazyColumn {
138
+ items(dummyRecentSearchList) { item ->
139
+ RestaurantSearchItem (item)
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ }
76
146
}
77
147
}
78
148
)
0 commit comments