Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions core/ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,10 @@
<string name="profile_photo_helper">JPG, PNG, JPEG (не более 5мб)</string>
<string name="about_me_tab">О себе любимом(-ой)</string>
<string name="about_me_tab_label">Расскажи о себе всему сообществу. Мы ценим человека за его профессиональные качества, поэтому пиши всё, чем хочешь поделиться.</string>
<string name="about_me_tab_placeholder">Android разработчик с фокусом на Compose и архитектуру.</string>
<string name="skills_tab">Твои навыки</string>
<string name="skills_tab_label">Покажи, что ты умеешь, и в чём ты действительно хорош.</string>
<string name="skills_dropdown_menu_label">Навык</string>
<string name="skills_dropdown_menu_placeholder">Выбери навык из списка</string>
<string name="skills_selected_label">Выбранные навыки</string>
</resources>
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)
Expand All @@ -93,5 +69,8 @@ fun ProfileEditAboutMePreview() {
aboutMeField = "Android разработчик с фокусом на Compose и архитектуру. ",
)

AboutMeContent(state = aboutMeState)
AboutMeContent(
state = aboutMeState,
onEvent = {}
)
}
Original file line number Diff line number Diff line change
@@ -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<String> = 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 = {},
)
}
Loading