-
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.
Merge remote-tracking branch 'origin/develop' into feat/#24-bottom-sheet
# Conflicts: # app/build.gradle.kts
- Loading branch information
Showing
4 changed files
with
224 additions
and
0 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
123 changes: 123 additions & 0 deletions
123
app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/IconDropdownMenu.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,123 @@ | ||
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.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.widthIn | ||
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.key | ||
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.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 | ||
import kotlinx.collections.immutable.ImmutableList | ||
import kotlinx.collections.immutable.immutableListOf | ||
|
||
@Composable | ||
fun IconDropdownMenu( | ||
menuItems: ImmutableList<String>, | ||
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 | ||
.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 -> | ||
key(menuItem) { | ||
Box( | ||
modifier = Modifier | ||
.widthIn(min = 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 | ||
private fun IconDropdownMenuOnePreview() { | ||
val menuItems = immutableListOf("신고하기") | ||
SpoonyAndroidTheme { | ||
IconDropdownMenu( | ||
menuItems = menuItems, | ||
onMenuItemClick = { selectedItem -> | ||
// selectedItem | ||
} | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun IconDropdownMenuTwoPreview() { | ||
val menuItems = immutableListOf("신고하기", "수정하기") | ||
SpoonyAndroidTheme { | ||
IconDropdownMenu( | ||
menuItems = menuItems, | ||
onMenuItemClick = { selectedItem -> | ||
// selectedItem | ||
} | ||
) | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/UserProfileInfo.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,84 @@ | ||
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.height | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.CircleShape | ||
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.layout.ContentScale | ||
import androidx.compose.ui.platform.LocalContext | ||
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.core.designsystem.theme.SpoonyAndroidTheme | ||
|
||
@Composable | ||
fun UserProfileInfo( | ||
imageUrl: String, | ||
name: String, | ||
location: String, | ||
modifier: Modifier = Modifier | ||
) { | ||
val context = LocalContext.current | ||
|
||
Row( | ||
modifier = modifier, | ||
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 { | ||
Text( | ||
text = name, | ||
style = SpoonyAndroidTheme.typography.body2b, | ||
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, | ||
maxLines = 1, | ||
overflow = TextOverflow.Ellipsis | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun UserProfileInfoPreview() { | ||
SpoonyAndroidTheme { | ||
UserProfileInfo( | ||
imageUrl = "https://gratisography.com/wp-content/uploads/2024/10/gratisography-cool-cat-800x525.jpg", | ||
name = "클레오가트라", | ||
location = "마포구 수저" | ||
) | ||
} | ||
} |
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,15 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M12,4m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" | ||
android:fillColor="#878A93"/> | ||
<path | ||
android:pathData="M12,12m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" | ||
android:fillColor="#878A93"/> | ||
<path | ||
android:pathData="M12,20m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" | ||
android:fillColor="#878A93"/> | ||
</vector> |