@@ -24,6 +24,9 @@ import com.ninecraft.booket.core.common.constants.BookStatus
2424import com.ninecraft.booket.core.common.extensions.toErrorType
2525import com.ninecraft.booket.core.designsystem.DevicePreview
2626import com.ninecraft.booket.core.designsystem.component.ReedDivider
27+ import com.ninecraft.booket.core.designsystem.component.button.ReedButton
28+ import com.ninecraft.booket.core.designsystem.component.button.ReedButtonColorStyle
29+ import com.ninecraft.booket.core.designsystem.component.button.smallButtonStyle
2730import com.ninecraft.booket.core.designsystem.component.textfield.ReedTextField
2831import com.ninecraft.booket.core.designsystem.theme.ReedTheme
2932import com.ninecraft.booket.core.designsystem.theme.White
@@ -114,19 +117,19 @@ internal fun BookSearchContent(
114117 ReedDivider ()
115118 Spacer (modifier = Modifier .height(ReedTheme .spacing.spacing2))
116119
117- when (state.uiState ) {
118- is UiState .Loading -> {
120+ when (state.searchUiState ) {
121+ is SearchUiState .Loading -> {
119122 ReedLoadingIndicator ()
120123 }
121124
122- is UiState .Error -> {
125+ is SearchUiState .Error -> {
123126 ReedErrorUi (
124- errorType = state.uiState .exception.toErrorType(),
127+ errorType = state.searchUiState .exception.toErrorType(),
125128 onRetryClick = { state.eventSink(BookSearchUiEvent .OnRetryClick ) },
126129 )
127130 }
128131
129- is UiState .Idle -> {
132+ is SearchUiState .Idle -> {
130133 if (state.recentSearches.isEmpty()) {
131134 Box (
132135 modifier = Modifier .fillMaxSize(),
@@ -173,17 +176,33 @@ internal fun BookSearchContent(
173176 }
174177 }
175178
176- is UiState .Success -> {
179+ is SearchUiState .Success -> {
177180 if (state.isEmptySearchResult) {
178181 Box (
179182 modifier = Modifier .fillMaxSize(),
180183 contentAlignment = Alignment .Center ,
181184 ) {
182- Text (
183- text = stringResource(R .string.empty_results),
184- color = ReedTheme .colors.contentSecondary,
185- style = ReedTheme .typography.body1Medium,
186- )
185+ Column (
186+ horizontalAlignment = Alignment .CenterHorizontally ,
187+ ) {
188+ Text (
189+ text = stringResource(R .string.empty_results_title),
190+ color = ReedTheme .colors.contentPrimary,
191+ style = ReedTheme .typography.headline1SemiBold,
192+ )
193+ Text (
194+ text = stringResource(R .string.empty_results_description),
195+ color = ReedTheme .colors.contentSecondary,
196+ style = ReedTheme .typography.body1Medium,
197+ )
198+ Spacer (modifier = Modifier .height(ReedTheme .spacing.spacing4))
199+ ReedButton (
200+ onClick = { state.eventSink(BookSearchUiEvent .OnInquireClick ) },
201+ text = stringResource(R .string.inquire),
202+ sizeStyle = smallButtonStyle,
203+ colorStyle = ReedButtonColorStyle .SECONDARY ,
204+ )
205+ }
187206 }
188207 } else {
189208 Row (
@@ -294,7 +313,7 @@ internal fun BookSearchContent(
294313
295314@DevicePreview
296315@Composable
297- private fun BookSearchPreview () {
316+ private fun BookRecentSearchPreview () {
298317 ReedTheme {
299318 BookSearchUi (
300319 state = BookSearchUiState (
@@ -303,3 +322,16 @@ private fun BookSearchPreview() {
303322 )
304323 }
305324}
325+
326+ @DevicePreview
327+ @Composable
328+ private fun BookSearchEmptyResultPreview () {
329+ ReedTheme {
330+ BookSearchContent (
331+ state = BookSearchUiState (
332+ searchUiState = SearchUiState .Success ,
333+ eventSink = {},
334+ ),
335+ )
336+ }
337+ }
0 commit comments