-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
140 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
.../src/main/java/com/easyhz/noffice/feature/organization/component/creation/CategoryView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.easyhz.noffice.feature.organization.component.creation | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.grid.GridCells | ||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid | ||
import androidx.compose.foundation.lazy.grid.itemsIndexed | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||
import com.easyhz.noffice.core.design_system.R | ||
import com.easyhz.noffice.core.design_system.component.button.CheckButton | ||
import com.easyhz.noffice.core.design_system.component.button.CheckButtonDefaults | ||
import com.easyhz.noffice.core.design_system.component.button.MediumButton | ||
import com.easyhz.noffice.core.design_system.theme.Green100 | ||
import com.easyhz.noffice.core.design_system.theme.Green700 | ||
import com.easyhz.noffice.core.design_system.theme.Grey50 | ||
import com.easyhz.noffice.core.design_system.theme.Grey600 | ||
import com.easyhz.noffice.feature.organization.contract.creation.CreationIntent | ||
import com.easyhz.noffice.feature.organization.screen.creation.OrganizationCreationViewModel | ||
|
||
@Composable | ||
internal fun CategoryView( | ||
modifier: Modifier = Modifier, | ||
viewModel: OrganizationCreationViewModel = hiltViewModel() | ||
) { | ||
val uiState by viewModel.uiState.collectAsStateWithLifecycle() | ||
|
||
Column( | ||
modifier = modifier | ||
) { | ||
CommonHeader( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 16.dp, horizontal = 8.dp), | ||
title = stringResource(id = R.string.organization_creation_category_title) | ||
) | ||
LazyVerticalGrid( | ||
modifier = Modifier.weight(1f).padding(top = 8.dp), | ||
columns = GridCells.Fixed(2), | ||
verticalArrangement = Arrangement.spacedBy(10.dp), | ||
horizontalArrangement = Arrangement.spacedBy(7.dp) | ||
) { | ||
itemsIndexed(uiState.category) { index, item -> | ||
CheckButton( | ||
modifier = Modifier.weight(1f), | ||
textAlign = TextAlign.Center, | ||
text = item.title, | ||
isComplete = item.isSelected, | ||
color = CheckButtonDefaults( | ||
completeContainerColor = Green100, | ||
completeContentColor = Green700, | ||
completeIconColor = null, | ||
incompleteContainerColor = Grey50, | ||
incompleteContentColor = Grey600, | ||
incompleteIconColor = null | ||
) | ||
) { | ||
viewModel.postIntent(CreationIntent.ClickCategoryItem(index)) | ||
} | ||
} | ||
} | ||
MediumButton( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(bottom = 16.dp), | ||
text = stringResource(id = R.string.sign_up_button), | ||
enabled = uiState.enabledStepButton[uiState.step.currentStep] ?: false | ||
) { | ||
viewModel.postIntent(CreationIntent.ClickNextButton) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...anization/src/main/java/com/easyhz/noffice/feature/organization/util/creation/Category.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.easyhz.noffice.feature.organization.util.creation | ||
|
||
import com.easyhz.noffice.feature.organization.contract.creation.CategoryState | ||
|
||
//enum class Category { | ||
//} | ||
|
||
val Category = listOf("IT 계열", "문화 생활", "어학", "예술", "음악 · 공연", "스터디 · 연구", "스포츠", "창업", "종교", "마케팅 · 홍보", "자연과학", "기타") | ||
|
||
fun List<String>.toState(): List<CategoryState> = map { | ||
CategoryState( | ||
it, false | ||
) | ||
} |