From 42fcf012f2b5f8e67af2760cef52e63037880cd1 Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 05:20:58 +0900 Subject: [PATCH 01/17] =?UTF-8?q?[FEAT/#29]=20ic=5Fmenu=5F24=20=EC=95=84?= =?UTF-8?q?=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/drawable/ic_menu_24.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/src/main/res/drawable/ic_menu_24.xml diff --git a/app/src/main/res/drawable/ic_menu_24.xml b/app/src/main/res/drawable/ic_menu_24.xml new file mode 100644 index 0000000..7efbe08 --- /dev/null +++ b/app/src/main/res/drawable/ic_menu_24.xml @@ -0,0 +1,15 @@ + + + + + From fe4907563061c9f527b36af46b2ee8e011a18f9f Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 05:22:50 +0900 Subject: [PATCH 02/17] =?UTF-8?q?[FEAT/#29]=20=EC=9E=A5=EC=86=8C=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20Profile=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placeDetail/component/Profile.kt | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/Profile.kt diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/Profile.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/Profile.kt new file mode 100644 index 0000000..ec8e6fb --- /dev/null +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/Profile.kt @@ -0,0 +1,98 @@ +package com.spoony.spoony.presentation.placeDetail.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import coil.compose.AsyncImage +import coil.request.ImageRequest +import com.spoony.spoony.R +import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme +import com.spoony.spoony.core.util.extension.noRippleClickable + +@Composable +fun Profile( + imageUrl: String, + name: String, + location: String, + onClick: () -> Unit, + modifier: Modifier = Modifier +) { + val context = LocalContext.current + + Row( + modifier = modifier + .fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(14.dp) + ) { + AsyncImage( + model = ImageRequest.Builder(context) + .data(imageUrl) + .crossfade(true) + .build(), + modifier = Modifier + .size(48.dp) + .clip(CircleShape) + .background( + color = SpoonyAndroidTheme.colors.gray500, + shape = CircleShape + ), + contentScale = ContentScale.Crop, + contentDescription = null + ) + Column( + modifier = Modifier.weight(1f) + ) { + Text( + text = name, + style = SpoonyAndroidTheme.typography.body2b, + color = SpoonyAndroidTheme.colors.black + ) + Spacer(modifier = Modifier.height(4.dp)) + Text( + text = location, + style = SpoonyAndroidTheme.typography.caption1m, + color = SpoonyAndroidTheme.colors.gray400 + ) + } + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_24), + contentDescription = null, + tint = Color.Unspecified, + modifier = Modifier + .noRippleClickable(onClick) + ) + } +} + +@Preview +@Composable +private fun ProfilePreview() { + SpoonyAndroidTheme { + Profile( + imageUrl = "https://gratisography.com/wp-content/uploads/2024/10/gratisography-cool-cat-800x525.jpg", + name = "클레오가트라", + location = "마포구 수저", + onClick = {} + ) + } +} From b96c63ae42b8cc0500b8f4803c8d97136ec9bff3 Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 13:39:35 +0900 Subject: [PATCH 03/17] =?UTF-8?q?[FEAT/#29]=20Profile=20=3D>=20UserProfile?= =?UTF-8?q?Info=20=EB=A1=9C=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/{Profile.kt => UserProfileInfo.kt} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/{Profile.kt => UserProfileInfo.kt} (97%) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/Profile.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt similarity index 97% rename from app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/Profile.kt rename to app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt index ec8e6fb..746a658 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/Profile.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt @@ -29,7 +29,7 @@ import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme import com.spoony.spoony.core.util.extension.noRippleClickable @Composable -fun Profile( +fun UserProfileInfo( imageUrl: String, name: String, location: String, @@ -86,9 +86,9 @@ fun Profile( @Preview @Composable -private fun ProfilePreview() { +private fun UserProfileInfoPreview() { SpoonyAndroidTheme { - Profile( + UserProfileInfo( imageUrl = "https://gratisography.com/wp-content/uploads/2024/10/gratisography-cool-cat-800x525.jpg", name = "클레오가트라", location = "마포구 수저", From 632ba511bf830463fc1e5b2618ebb6be89fd5faa Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 13:42:06 +0900 Subject: [PATCH 04/17] =?UTF-8?q?[FEAT/#29]=20UserProfileInfo=20=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=93=9C=EB=A1=AD=EB=8B=A4=EC=9A=B4=20=EB=A9=94?= =?UTF-8?q?=EB=89=B4=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placeDetail/component/UserProfileInfo.kt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt index 746a658..f3eb71b 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt @@ -33,7 +33,6 @@ fun UserProfileInfo( imageUrl: String, name: String, location: String, - onClick: () -> Unit, modifier: Modifier = Modifier ) { val context = LocalContext.current @@ -74,13 +73,6 @@ fun UserProfileInfo( color = SpoonyAndroidTheme.colors.gray400 ) } - Icon( - imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_24), - contentDescription = null, - tint = Color.Unspecified, - modifier = Modifier - .noRippleClickable(onClick) - ) } } @@ -92,7 +84,6 @@ private fun UserProfileInfoPreview() { imageUrl = "https://gratisography.com/wp-content/uploads/2024/10/gratisography-cool-cat-800x525.jpg", name = "클레오가트라", location = "마포구 수저", - onClick = {} ) } } From c4cf4c966c81b0f34d54957a5a82d40471e50834 Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 13:43:35 +0900 Subject: [PATCH 05/17] =?UTF-8?q?[FEAT/#29]=20UserProfileInfo=20=EC=98=81?= =?UTF-8?q?=EC=97=AD=20=EB=B2=94=EC=9C=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/placeDetail/component/UserProfileInfo.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt index f3eb71b..2655ded 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt @@ -38,8 +38,7 @@ fun UserProfileInfo( val context = LocalContext.current Row( - modifier = modifier - .fillMaxWidth(), + modifier = modifier, verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(14.dp) ) { @@ -58,9 +57,7 @@ fun UserProfileInfo( contentScale = ContentScale.Crop, contentDescription = null ) - Column( - modifier = Modifier.weight(1f) - ) { + Column { Text( text = name, style = SpoonyAndroidTheme.typography.body2b, From 293057cf741a583c35fb0f788f267cea326ab065 Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 13:44:18 +0900 Subject: [PATCH 06/17] =?UTF-8?q?[FEAT/#29]=20ktLintFormat=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placeDetail/component/UserProfileInfo.kt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt index 2655ded..7f5db2b 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt @@ -5,28 +5,21 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import coil.request.ImageRequest -import com.spoony.spoony.R import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme -import com.spoony.spoony.core.util.extension.noRippleClickable @Composable fun UserProfileInfo( @@ -80,7 +73,7 @@ private fun UserProfileInfoPreview() { UserProfileInfo( imageUrl = "https://gratisography.com/wp-content/uploads/2024/10/gratisography-cool-cat-800x525.jpg", name = "클레오가트라", - location = "마포구 수저", + location = "마포구 수저" ) } } From 71d0ca33bb1b55366d4eeb559c410f844857f957 Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 14:47:12 +0900 Subject: [PATCH 07/17] =?UTF-8?q?[FEAT/#29]=20UserProfileInfo=20maxLines?= =?UTF-8?q?=20=EB=B0=8F=20overflow=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placeDetail/component/UserProfileInfo.kt | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt index 7f5db2b..136cfc7 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt @@ -5,20 +5,27 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import coil.request.ImageRequest +import com.spoony.spoony.R import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme @Composable @@ -54,13 +61,17 @@ fun UserProfileInfo( Text( text = name, style = SpoonyAndroidTheme.typography.body2b, - color = SpoonyAndroidTheme.colors.black + color = SpoonyAndroidTheme.colors.black, + maxLines = 1, + overflow = TextOverflow.Ellipsis ) Spacer(modifier = Modifier.height(4.dp)) Text( text = location, style = SpoonyAndroidTheme.typography.caption1m, - color = SpoonyAndroidTheme.colors.gray400 + color = SpoonyAndroidTheme.colors.gray400, + maxLines = 1, + overflow = TextOverflow.Ellipsis ) } } @@ -77,3 +88,27 @@ private fun UserProfileInfoPreview() { ) } } + +@Preview(showBackground = true) +@Composable +private fun UserProfileInfoMenuPreview() { + SpoonyAndroidTheme { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(14.dp), + verticalAlignment = Alignment.CenterVertically + ) { + UserProfileInfo( + imageUrl = "https://gratisography.com/wp-content/uploads/2024/10/gratisography-cool-cat-800x525.jpg", + name = "클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라", + location = "마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저", + modifier = Modifier.weight(1f) + ) + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_24), + contentDescription = null, + tint = Color.Unspecified + ) + } + } +} From e930c5428e6417e3bbc2810a34d61774a307d3a3 Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 14:56:24 +0900 Subject: [PATCH 08/17] =?UTF-8?q?[FEAT/#29]=20ic=5Fmenu=5F24=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EB=B0=8F=20UserProfileInfoMenuPreview=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placeDetail/component/UserProfileInfo.kt | 30 ------------------- app/src/main/res/drawable/ic_menu_24.xml | 15 ---------- 2 files changed, 45 deletions(-) delete mode 100644 app/src/main/res/drawable/ic_menu_24.xml diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt index 136cfc7..bf2f6be 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.kt @@ -5,27 +5,21 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import coil.request.ImageRequest -import com.spoony.spoony.R import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme @Composable @@ -88,27 +82,3 @@ private fun UserProfileInfoPreview() { ) } } - -@Preview(showBackground = true) -@Composable -private fun UserProfileInfoMenuPreview() { - SpoonyAndroidTheme { - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(14.dp), - verticalAlignment = Alignment.CenterVertically - ) { - UserProfileInfo( - imageUrl = "https://gratisography.com/wp-content/uploads/2024/10/gratisography-cool-cat-800x525.jpg", - name = "클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라클레오가트라", - location = "마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저마포구 수저", - modifier = Modifier.weight(1f) - ) - Icon( - imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_24), - contentDescription = null, - tint = Color.Unspecified - ) - } - } -} diff --git a/app/src/main/res/drawable/ic_menu_24.xml b/app/src/main/res/drawable/ic_menu_24.xml deleted file mode 100644 index 7efbe08..0000000 --- a/app/src/main/res/drawable/ic_menu_24.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - From 1debef3a08924005fa08de61ee4cbddb2d18d42a Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 17:16:34 +0900 Subject: [PATCH 09/17] =?UTF-8?q?[FEAT/#32]=20ic=5Fmenu=5F24=20=EC=95=84?= =?UTF-8?q?=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/drawable/ic_menu_24.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/src/main/res/drawable/ic_menu_24.xml diff --git a/app/src/main/res/drawable/ic_menu_24.xml b/app/src/main/res/drawable/ic_menu_24.xml new file mode 100644 index 0000000..7efbe08 --- /dev/null +++ b/app/src/main/res/drawable/ic_menu_24.xml @@ -0,0 +1,15 @@ + + + + + From 0f46ba7b8e68ba60790aa239723de865fe137d4f Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 17:27:51 +0900 Subject: [PATCH 10/17] =?UTF-8?q?[FEAT/#32]=20IconDropdownMenu=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placeDetail/component/IconDropdownMenu.kt | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt new file mode 100644 index 0000000..7946768 --- /dev/null +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt @@ -0,0 +1,121 @@ +package com.spoony.spoony.presentation.placeDetail.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +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.layout.width +import androidx.compose.foundation.layout.wrapContentSize +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.shadow +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.spoony.spoony.R +import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme +import com.spoony.spoony.core.util.extension.noRippleClickable + +@Composable +fun IconDropdownMenu( + menuItems: List, + onMenuItemClick: (String) -> Unit, + modifier: Modifier = Modifier +) { + var expanded by remember { mutableStateOf(false) } + + Column(modifier = modifier.wrapContentSize(Alignment.TopEnd)) { + Icon( + imageVector = ImageVector.vectorResource(R.drawable.ic_menu_24), + contentDescription = null, + tint = SpoonyAndroidTheme.colors.gray500, + modifier = Modifier + .noRippleClickable { + expanded = !expanded + } + ) + Spacer(modifier = Modifier.height(4.dp)) + MaterialTheme( + shapes = MaterialTheme.shapes.copy(RoundedCornerShape(10.dp)) + ) { + DropdownMenu( + expanded = expanded, + modifier = Modifier + .shadow(30.dp, RoundedCornerShape(10.dp)) + .background( + color = SpoonyAndroidTheme.colors.white, + shape = RoundedCornerShape(10.dp) + ) + .padding( + vertical = 2.dp, + horizontal = 8.dp + ), + onDismissRequest = { expanded = false } + ) { + Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { + menuItems.forEach { menuItem -> + Box( + modifier = Modifier + .width(91.dp) + .noRippleClickable { + onMenuItemClick(menuItem) + expanded = false + } + .padding(6.dp), + contentAlignment = Alignment.CenterStart + ) { + Text( + text = menuItem, + style = SpoonyAndroidTheme.typography.caption1b, + color = SpoonyAndroidTheme.colors.gray900 + ) + } + } + } + } + } + } +} + +@Preview +@Composable +fun IconDropdownMenuOnePreview() { + val menuItems = listOf("신고하기") + SpoonyAndroidTheme { + IconDropdownMenu( + menuItems = menuItems, + onMenuItemClick = { selectedItem -> + // selectedItem + } + ) + } +} + +@Preview +@Composable +fun IconDropdownMenuTwoPreview() { + val menuItems = listOf("신고하기", "수정하기") + SpoonyAndroidTheme { + IconDropdownMenu( + menuItems = menuItems, + onMenuItemClick = { selectedItem -> + // selectedItem + } + ) + } +} From 329fee69b51c7439494e3d6976e4b72acf9914fb Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 17:31:35 +0900 Subject: [PATCH 11/17] =?UTF-8?q?[FEAT/#32]=20ktLintFormat=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/placeDetail/component/IconDropdownMenu.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt index 7946768..2d3f5a2 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box 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.layout.width From d2025dd2c07386e1a10f40462195b92c6b994eb1 Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 22:33:00 +0900 Subject: [PATCH 12/17] =?UTF-8?q?[Feat/#32]=20=EC=A0=81=EC=9A=A9=EB=90=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20shadow=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/placeDetail/component/IconDropdownMenu.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt index 2d3f5a2..dfd60d7 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt @@ -21,7 +21,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.shadow import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview @@ -55,7 +54,6 @@ fun IconDropdownMenu( DropdownMenu( expanded = expanded, modifier = Modifier - .shadow(30.dp, RoundedCornerShape(10.dp)) .background( color = SpoonyAndroidTheme.colors.white, shape = RoundedCornerShape(10.dp) From d2d6f415c7a9a43f366b4606774ea9fbb27f66b7 Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 22:43:24 +0900 Subject: [PATCH 13/17] =?UTF-8?q?[Feat/#32]=20menuItems=20forEach=20key=20?= =?UTF-8?q?=EA=B0=92=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placeDetail/component/IconDropdownMenu.kt | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt index dfd60d7..5e81b5b 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt @@ -16,6 +16,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.key import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -66,21 +67,23 @@ fun IconDropdownMenu( ) { Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { menuItems.forEach { menuItem -> - Box( - modifier = Modifier - .width(91.dp) - .noRippleClickable { - onMenuItemClick(menuItem) - expanded = false - } - .padding(6.dp), - contentAlignment = Alignment.CenterStart - ) { - Text( - text = menuItem, - style = SpoonyAndroidTheme.typography.caption1b, - color = SpoonyAndroidTheme.colors.gray900 - ) + key(menuItem) { + Box( + modifier = Modifier + .width(91.dp) + .noRippleClickable { + onMenuItemClick(menuItem) + expanded = false + } + .padding(6.dp), + contentAlignment = Alignment.CenterStart + ) { + Text( + text = menuItem, + style = SpoonyAndroidTheme.typography.caption1b, + color = SpoonyAndroidTheme.colors.gray900 + ) + } } } } From b32dea174c6e507033cf47178c7aae2f54f64f1d Mon Sep 17 00:00:00 2001 From: roel Date: Wed, 15 Jan 2025 23:51:34 +0900 Subject: [PATCH 14/17] =?UTF-8?q?[Feat/#32]=20IconDropdownMenu=20Preview?= =?UTF-8?q?=20private=20fun=20=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/placeDetail/component/IconDropdownMenu.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt index 5e81b5b..5d6d5db 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt @@ -94,7 +94,7 @@ fun IconDropdownMenu( @Preview @Composable -fun IconDropdownMenuOnePreview() { +private fun IconDropdownMenuOnePreview() { val menuItems = listOf("신고하기") SpoonyAndroidTheme { IconDropdownMenu( @@ -108,7 +108,7 @@ fun IconDropdownMenuOnePreview() { @Preview @Composable -fun IconDropdownMenuTwoPreview() { +private fun IconDropdownMenuTwoPreview() { val menuItems = listOf("신고하기", "수정하기") SpoonyAndroidTheme { IconDropdownMenu( From a8aa84b63f113c2e528633a9191e801416b2425f Mon Sep 17 00:00:00 2001 From: roel Date: Thu, 16 Jan 2025 00:31:09 +0900 Subject: [PATCH 15/17] =?UTF-8?q?[Feat/#32]=20ImmutableList=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20IconDropdownMenu=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 ++ .../placeDetail/component/IconDropdownMenu.kt | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2d0daf3..3a0e32f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -82,6 +82,8 @@ dependencies { implementation(libs.coil.compose) implementation(libs.timber) implementation(libs.lottie) + + implementation(libs.kotlinx.immutable) } ktlint { diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt index 5d6d5db..62ecc39 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt @@ -29,10 +29,12 @@ import androidx.compose.ui.unit.dp import com.spoony.spoony.R import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme import com.spoony.spoony.core.util.extension.noRippleClickable +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList @Composable fun IconDropdownMenu( - menuItems: List, + menuItems: ImmutableList, onMenuItemClick: (String) -> Unit, modifier: Modifier = Modifier ) { @@ -95,7 +97,7 @@ fun IconDropdownMenu( @Preview @Composable private fun IconDropdownMenuOnePreview() { - val menuItems = listOf("신고하기") + val menuItems = listOf("신고하기").toImmutableList() SpoonyAndroidTheme { IconDropdownMenu( menuItems = menuItems, @@ -109,7 +111,7 @@ private fun IconDropdownMenuOnePreview() { @Preview @Composable private fun IconDropdownMenuTwoPreview() { - val menuItems = listOf("신고하기", "수정하기") + val menuItems = listOf("신고하기", "수정하기").toImmutableList() SpoonyAndroidTheme { IconDropdownMenu( menuItems = menuItems, From 087dfdbb40179bcc7822f11ab3b12168689e5a8a Mon Sep 17 00:00:00 2001 From: roel Date: Thu, 16 Jan 2025 00:36:45 +0900 Subject: [PATCH 16/17] =?UTF-8?q?[Feat/#32]=20width=20->=20minWidth=20?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/placeDetail/component/IconDropdownMenu.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt index 62ecc39..ad8c38b 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt @@ -7,7 +7,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.DropdownMenu @@ -72,7 +72,7 @@ fun IconDropdownMenu( key(menuItem) { Box( modifier = Modifier - .width(91.dp) + .widthIn(min = 91.dp) .noRippleClickable { onMenuItemClick(menuItem) expanded = false From a3cdc9d977425030162f9c0d9c23bdbf026cfb53 Mon Sep 17 00:00:00 2001 From: roel Date: Thu, 16 Jan 2025 00:47:39 +0900 Subject: [PATCH 17/17] =?UTF-8?q?[Feat/#32]=20toImmutableList=20->=20immut?= =?UTF-8?q?ableListOf=20=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/placeDetail/component/IconDropdownMenu.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt index ad8c38b..10f6004 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.kt @@ -30,7 +30,7 @@ import com.spoony.spoony.R import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme import com.spoony.spoony.core.util.extension.noRippleClickable import kotlinx.collections.immutable.ImmutableList -import kotlinx.collections.immutable.toImmutableList +import kotlinx.collections.immutable.immutableListOf @Composable fun IconDropdownMenu( @@ -97,7 +97,7 @@ fun IconDropdownMenu( @Preview @Composable private fun IconDropdownMenuOnePreview() { - val menuItems = listOf("신고하기").toImmutableList() + val menuItems = immutableListOf("신고하기") SpoonyAndroidTheme { IconDropdownMenu( menuItems = menuItems, @@ -111,7 +111,7 @@ private fun IconDropdownMenuOnePreview() { @Preview @Composable private fun IconDropdownMenuTwoPreview() { - val menuItems = listOf("신고하기", "수정하기").toImmutableList() + val menuItems = immutableListOf("신고하기", "수정하기") SpoonyAndroidTheme { IconDropdownMenu( menuItems = menuItems,