Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

검색 결과 UI #258

Merged
merged 5 commits into from
Oct 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Feat] 검색 결과 화면 인풋 텍스트 update 로직 추가
JaesungLeee committed Sep 30, 2024

Verified

This commit was signed with the committer’s verified signature.
infeo Armin Schrenk
commit f34e5df74c7805cde8c478370702b225e9b4f1e1
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ internal fun SearchResultRoute(
BaseComposable(viewModel = viewModel) { uiState ->
SearchResultScreen(
modifier = modifier,
uiState = uiState
uiState = uiState,
onQueryChange = viewModel::updateSearchQuery
)
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
package team.ppac.search.result

import androidx.compose.material.Text
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import team.ppac.designsystem.component.scaffold.FarmemeScaffold
import team.ppac.designsystem.component.toolbar.FarmemeSearchToolbar
import team.ppac.search.result.mvi.SearchResultUiState

@Composable
internal fun SearchResultScreen(
modifier: Modifier = Modifier,
uiState: SearchResultUiState,
onQueryChange: (String) -> Unit,
) {
Text(text = "검색 결과")
FarmemeScaffold(
modifier = modifier.fillMaxSize(),
topBar = {
FarmemeSearchToolbar(
text = uiState.query,
onTextChanged = onQueryChange
)
}
) {

}
}
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@ import javax.inject.Inject

@HiltViewModel
class SearchResultViewModel @Inject constructor(
savedStateHandle: SavedStateHandle
): BaseViewModel<SearchResultUiState, SearchResultSideEffect, SearchResultIntent>(savedStateHandle){
savedStateHandle: SavedStateHandle,
) : BaseViewModel<SearchResultUiState, SearchResultSideEffect, SearchResultIntent>(savedStateHandle) {

override fun createInitialState(savedStateHandle: SavedStateHandle): SearchResultUiState {
return SearchResultUiState.INITIAL_STATE
@@ -24,4 +24,8 @@ class SearchResultViewModel @Inject constructor(
override fun handleClientException(throwable: Throwable) {
TODO("Not yet implemented")
}

fun updateSearchQuery(query: String) {
reduce { copy(query = query) }
}
}
Original file line number Diff line number Diff line change
@@ -4,11 +4,13 @@ import team.ppac.common.android.base.UiState

data class SearchResultUiState(
val isLoading: Boolean,
val query: String
) : UiState {

companion object {
val INITIAL_STATE = SearchResultUiState(
isLoading = true
isLoading = true,
query = ""
)
}
}