From 5b9d2b756b56e99666784ff08b93384986d7364e Mon Sep 17 00:00:00 2001 From: Clara Dautermann Date: Tue, 13 May 2025 23:11:36 +0200 Subject: [PATCH] make skills cards expandable --- DBTApp/.idea/codeStyles/Project.xml | 117 ++++++++++++++++++ DBTApp/.idea/codeStyles/codeStyleConfig.xml | 5 + .../de/cdaut/dbtapp/components/SkillsList.kt | 34 ++++- DBTApp/app/src/main/res/values-de/strings.xml | 1 + DBTApp/app/src/main/res/values/strings.xml | 1 + 5 files changed, 152 insertions(+), 6 deletions(-) create mode 100644 DBTApp/.idea/codeStyles/Project.xml create mode 100644 DBTApp/.idea/codeStyles/codeStyleConfig.xml diff --git a/DBTApp/.idea/codeStyles/Project.xml b/DBTApp/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..4bec4ea --- /dev/null +++ b/DBTApp/.idea/codeStyles/Project.xml @@ -0,0 +1,117 @@ + + + + + + \ No newline at end of file diff --git a/DBTApp/.idea/codeStyles/codeStyleConfig.xml b/DBTApp/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/DBTApp/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/DBTApp/app/src/main/java/de/cdaut/dbtapp/components/SkillsList.kt b/DBTApp/app/src/main/java/de/cdaut/dbtapp/components/SkillsList.kt index 3f93d07..38a51de 100644 --- a/DBTApp/app/src/main/java/de/cdaut/dbtapp/components/SkillsList.kt +++ b/DBTApp/app/src/main/java/de/cdaut/dbtapp/components/SkillsList.kt @@ -1,5 +1,6 @@ package de.cdaut.dbtapp.components +import androidx.annotation.StringRes import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.clickable @@ -21,6 +22,8 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowDropDown +import androidx.compose.material.icons.filled.ArrowDropUp import androidx.compose.material.icons.filled.Star import androidx.compose.material.icons.outlined.Star import androidx.compose.material.icons.outlined.StarOutline @@ -66,17 +69,36 @@ private fun SkillsCategoryCardPrev() { @Composable fun SkillsCategoryCard(skills: List, title: String) { + var enabled by remember { + mutableStateOf(false) + } + Card( Modifier .fillMaxWidth() .padding(10.dp) ) { - TitleText( - modifier = Modifier.padding(10.dp), - content = title - ) - skills.forEach { skill -> - SingleSkillCard(skill.title, skill.description) + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween, + modifier = Modifier.fillMaxWidth() + ) { + TitleText( + modifier = Modifier.padding(10.dp), + content = title + ) + Icon( + modifier = Modifier + .padding(5.dp) + .clickable(onClick = { enabled = !enabled }), + imageVector = if (enabled) Icons.Filled.ArrowDropUp else Icons.Filled.ArrowDropDown, + contentDescription = stringResource(R.string.desc_btn_expand) + ) + } + if (enabled) { + skills.forEach { skill -> + SingleSkillCard(skill.title, skill.description) + } } } } diff --git a/DBTApp/app/src/main/res/values-de/strings.xml b/DBTApp/app/src/main/res/values-de/strings.xml index e45a695..bcd3ea3 100644 --- a/DBTApp/app/src/main/res/values-de/strings.xml +++ b/DBTApp/app/src/main/res/values-de/strings.xml @@ -8,4 +8,5 @@ Skillsketten Notfallknopf Favorisieren Button + Ausklappen \ No newline at end of file diff --git a/DBTApp/app/src/main/res/values/strings.xml b/DBTApp/app/src/main/res/values/strings.xml index 51849cb..8a63e78 100644 --- a/DBTApp/app/src/main/res/values/strings.xml +++ b/DBTApp/app/src/main/res/values/strings.xml @@ -7,4 +7,5 @@ Skills Chains Emergency Button Favourte Button + Expand \ No newline at end of file