diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml index 8aec72ef..524ee6d9 100644 --- a/core/ui/src/main/res/values/strings.xml +++ b/core/ui/src/main/res/values/strings.xml @@ -49,4 +49,10 @@ JPG, PNG, JPEG (не более 5мб) О себе любимом(-ой) Расскажи о себе всему сообществу. Мы ценим человека за его профессиональные качества, поэтому пиши всё, чем хочешь поделиться. + Android разработчик с фокусом на Compose и архитектуру. + Твои навыки + Покажи, что ты умеешь, и в чём ты действительно хорош. + Навык + Выбери навык из списка + Выбранные навыки \ No newline at end of file diff --git a/feature/profile-edit/impl/src/main/java/ru/yeahub/profile_edit/impl/ui/tabs/ProfileEditAboutMeTab.kt b/feature/profile-edit/impl/src/main/java/ru/yeahub/profile_edit/impl/ui/tabs/ProfileEditAboutMeTab.kt index 95cf94e0..7c5fd442 100644 --- a/feature/profile-edit/impl/src/main/java/ru/yeahub/profile_edit/impl/ui/tabs/ProfileEditAboutMeTab.kt +++ b/feature/profile-edit/impl/src/main/java/ru/yeahub/profile_edit/impl/ui/tabs/ProfileEditAboutMeTab.kt @@ -1,23 +1,22 @@ package ru.yeahub.profile_edit.impl.ui.tabs +import android.R.attr.singleLine import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import ru.yeahub.core_ui.component.textInput.TextInputColorsDefaults +import ru.yeahub.core_ui.component.textInput.DefaultTextField import ru.yeahub.core_ui.theme.Theme import ru.yeahub.profile_edit.impl.presentation.ProfileEditState +import ru.yeahub.profile_edit.impl.presentation.intents.ProfileEditScreenEvent import ru.yeahub.profile_edit.impl.ui.SectionTitle import ru.yeahub.ui.R @@ -28,62 +27,39 @@ private val PURPLE_AREA_TEXT_SPACER = 8.dp @Composable fun AboutMeContent( - state: ProfileEditState.AboutMeTabState + state: ProfileEditState.AboutMeTabState, + onEvent: (ProfileEditScreenEvent) -> Unit, ) { - LazyColumn( + Column( modifier = Modifier .fillMaxWidth() .background(Theme.colors.white900) .padding(top = ABOUT_ME_TOP_PADDING), ) { - item { - Spacer(Modifier.padding(ABOUT_ME_TOP_SPACER)) - SectionTitle(title = stringResource(R.string.about_me_tab)) + Spacer(Modifier.padding(ABOUT_ME_TOP_SPACER)) + SectionTitle(title = stringResource(R.string.about_me_tab)) - Spacer(Modifier.padding(ABOUT_ME_MIDDLE_SPACER)) - Text( - text = stringResource(R.string.about_me_tab_label), - style = Theme.typography.body7Alt, - color = Theme.colors.black900, - modifier = Modifier.fillMaxWidth(), - ) - } - item { - Spacer(Modifier.padding(PURPLE_AREA_TEXT_SPACER)) - PurpleTextArea( - value = state.aboutMeField, - onValueChange = { /* TODO */ } - ) - } - } -} + Spacer(Modifier.padding(ABOUT_ME_MIDDLE_SPACER)) + Text( + text = stringResource(R.string.about_me_tab_label), + style = Theme.typography.body7Alt, + color = Theme.colors.black900, + modifier = Modifier.fillMaxWidth(), + ) -@Composable -fun PurpleTextArea( - value: String, - onValueChange: (String) -> Unit, - modifier: Modifier = Modifier, -) { - OutlinedTextField( - value = value, - onValueChange = onValueChange, - modifier = modifier - .fillMaxWidth() - .height(160.dp), - shape = RoundedCornerShape(20.dp), - placeholder = { - Text("Android разработчик с фокусом на Compose и архитектуру.") - }, - maxLines = Int.MAX_VALUE, - singleLine = false, - colors = OutlinedTextFieldDefaults.colors( - focusedBorderColor = TextInputColorsDefaults.activeBorder(), - unfocusedBorderColor = TextInputColorsDefaults.defaultsBorder(), - disabledBorderColor = TextInputColorsDefaults.defaultsBorder(), - cursorColor = TextInputColorsDefaults.activeBorder() - ), - textStyle = Theme.typography.body3 - ) + Spacer(Modifier.padding(PURPLE_AREA_TEXT_SPACER)) + + DefaultTextField( + value = state.aboutMeField, + placeholder = stringResource(R.string.about_me_tab_placeholder), + onValueChange = { onEvent(ProfileEditScreenEvent.ToDo) }, + onExpandedChange = { /* TODO */ }, + singleLine = false, + modifier = Modifier + .fillMaxWidth() + .height(160.dp), + ) + } } @Preview(showBackground = true) @@ -93,5 +69,8 @@ fun ProfileEditAboutMePreview() { aboutMeField = "Android разработчик с фокусом на Compose и архитектуру. ", ) - AboutMeContent(state = aboutMeState) + AboutMeContent( + state = aboutMeState, + onEvent = {} + ) } diff --git a/feature/profile-edit/impl/src/main/java/ru/yeahub/profile_edit/impl/ui/tabs/ProfileEditSkillsTab.kt b/feature/profile-edit/impl/src/main/java/ru/yeahub/profile_edit/impl/ui/tabs/ProfileEditSkillsTab.kt new file mode 100644 index 00000000..e48afcbf --- /dev/null +++ b/feature/profile-edit/impl/src/main/java/ru/yeahub/profile_edit/impl/ui/tabs/ProfileEditSkillsTab.kt @@ -0,0 +1,160 @@ +package ru.yeahub.profile_edit.impl.ui.tabs + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.FlowRow +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import kotlinx.collections.immutable.persistentListOf +import ru.yeahub.core_ui.component.DropDownMenu +import ru.yeahub.core_ui.component.SkillButton +import ru.yeahub.core_ui.theme.Theme +import ru.yeahub.profile_edit.impl.presentation.ProfileEditState +import ru.yeahub.profile_edit.impl.presentation.intents.ProfileEditScreenEvent +import ru.yeahub.profile_edit.impl.ui.FieldLabel +import ru.yeahub.profile_edit.impl.ui.SectionTitle +import ru.yeahub.ui.R + +private val SKILLS_TOP_PADDING = 2.dp +private val SKILLS_TOP_SPACER = 10.dp +private val SKILLS_SPACER_MIDDLE = 5.dp +private val SKILLS_SPACER_SMALL = 3.dp + +@Composable +fun SkillsContent( + state: ProfileEditState.SkillsTabState, + onEvent: (ProfileEditScreenEvent) -> Unit +) { + val skillNames: List = remember { + state.listOfSkills.map { it.name } + } + + LazyColumn( + modifier = Modifier + .fillMaxWidth() + .background(Theme.colors.white900) + .padding(top = SKILLS_TOP_PADDING), + ) { + item { + Spacer(Modifier.padding(SKILLS_TOP_SPACER)) + SectionTitle(title = stringResource(R.string.skills_tab)) + + Spacer(Modifier.padding(SKILLS_SPACER_MIDDLE)) + Text( + text = stringResource(R.string.skills_tab_label), + style = Theme.typography.body7Alt, + color = Theme.colors.black900, + modifier = Modifier.fillMaxWidth(), + ) + } + item { + Spacer(Modifier.padding(SKILLS_SPACER_MIDDLE)) + FieldLabel(text = stringResource(R.string.skills_dropdown_menu_label)) + + Spacer(Modifier.padding(SKILLS_SPACER_SMALL)) + DropDownMenu( + placeholder = stringResource(R.string.skills_dropdown_menu_placeholder), + items = skillNames, + selected = "", + onSelected = { + onEvent(ProfileEditScreenEvent.ToDo) + }, + modifier = Modifier.fillMaxWidth(), + ) + } + item { + Spacer(Modifier.padding(SKILLS_SPACER_MIDDLE)) + FieldLabel(text = stringResource(R.string.skills_selected_label)) + + Spacer(Modifier.padding(SKILLS_SPACER_SMALL)) + FlowRow( + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + state.listOfChosenSkills.forEach { skill -> + SkillButton( + enabled = true, + activeButton = true, + onClick = { }, + imageLeft = skill.image, + imageRight = R.drawable.icon_button_close, + text = skill.name, + onRightIconClick = { + onEvent(ProfileEditScreenEvent.ToDo) + }, + imageSizeLeftWith = 20.dp, + imageSizeLeftHigh = 20.dp, + ) + } + } + } + } +} + +@Preview(showBackground = true) +@Composable +fun ProfileEditSkillsPreview() { + val skillsState = ProfileEditState.SkillsTabState( + listOfSkills = persistentListOf( + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Kotlin1", + ), + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Jetpack Compose", + ), + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Coroutines", + ), + ), + listOfChosenSkills = persistentListOf( + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Kotlin2", + ), + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Jetpack Compose", + ), + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Coroutines", + ), + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Git", + ), + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Java", + ), + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Gradle", + ), + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Kotlin3", + ), + ProfileEditState.Skill( + image = R.drawable.icon_true_button, + name = "Coroutines", + ), + ), + ) + + SkillsContent( + state = skillsState, + onEvent = {}, + ) +}