Skip to content

Commit 0d003a0

Browse files
committed
feat: 피드 생성 이미지 컴포넌트 추가
1 parent f128009 commit 0d003a0

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.into.websoso.ui.createFeed.component
2+
3+
import androidx.compose.foundation.Image
4+
import androidx.compose.foundation.layout.Arrangement
5+
import androidx.compose.foundation.layout.Box
6+
import androidx.compose.foundation.layout.PaddingValues
7+
import androidx.compose.foundation.layout.aspectRatio
8+
import androidx.compose.foundation.layout.fillMaxWidth
9+
import androidx.compose.foundation.layout.padding
10+
import androidx.compose.foundation.layout.size
11+
import androidx.compose.foundation.lazy.LazyRow
12+
import androidx.compose.foundation.shape.RoundedCornerShape
13+
import androidx.compose.runtime.Composable
14+
import androidx.compose.ui.Alignment
15+
import androidx.compose.ui.Modifier
16+
import androidx.compose.ui.draw.clip
17+
import androidx.compose.ui.layout.ContentScale
18+
import androidx.compose.ui.res.painterResource
19+
import androidx.compose.ui.tooling.preview.Preview
20+
import androidx.compose.ui.unit.dp
21+
import com.into.websoso.core.common.ui.component.AdaptationImage
22+
import com.into.websoso.core.common.util.clickableWithoutRipple
23+
import com.into.websoso.core.designsystem.theme.WebsosoTheme
24+
import com.into.websoso.core.resource.R.drawable.ic_feed_remove_image
25+
26+
@Composable
27+
fun CreateFeedImageContainer(
28+
imageUrls: List<String> = listOf(
29+
"https://github.com/user-attachments/assets/e89a02bb-549f-414d-809f-0ab1e8f72c5f",
30+
"https://github.com/user-attachments/assets/e89a02bb-549f-414d-809f-0ab1e8f72c5f",
31+
"https://github.com/user-attachments/assets/e89a02bb-549f-414d-809f-0ab1e8f72c5f",
32+
),
33+
onRemoveClick: (Int) -> Unit,
34+
) {
35+
LazyRow(
36+
modifier = Modifier
37+
.fillMaxWidth(),
38+
horizontalArrangement = Arrangement.spacedBy(10.dp),
39+
contentPadding = PaddingValues(horizontal = 20.dp),
40+
) {
41+
items(imageUrls.size) { index ->
42+
CreateFeedImageBox(
43+
imageUrl = imageUrls[index],
44+
onRemoveClick = {
45+
onRemoveClick(index)
46+
},
47+
)
48+
}
49+
}
50+
}
51+
52+
@Composable
53+
private fun CreateFeedImageBox(
54+
imageUrl: String,
55+
onRemoveClick: () -> Unit,
56+
) {
57+
Box(
58+
modifier = Modifier
59+
.size(100.dp)
60+
.aspectRatio(1f)
61+
.clip(RoundedCornerShape(8.dp)),
62+
) {
63+
Image(
64+
painter = painterResource(ic_feed_remove_image),
65+
contentDescription = null,
66+
modifier = Modifier
67+
.size(38.dp)
68+
.padding(10.dp)
69+
.align(Alignment.TopEnd)
70+
.clickableWithoutRipple { onRemoveClick() },
71+
)
72+
AdaptationImage(
73+
imageUrl = imageUrl,
74+
contentScale = ContentScale.Crop,
75+
)
76+
}
77+
}
78+
79+
@Preview
80+
@Composable
81+
private fun CreateFeedImageContainerPreview() {
82+
WebsosoTheme {
83+
CreateFeedImageContainer(
84+
imageUrls = listOf(
85+
"https://github.com/user-attachments/assets/e89a02bb-549f-414d-809f-0ab1e8f72c5f",
86+
"https://github.com/user-attachments/assets/e89a02bb-549f-414d-809f-0ab1e8f72c5f",
87+
"https://github.com/user-attachments/assets/e89a02bb-549f-414d-809f-0ab1e8f72c5f",
88+
),
89+
onRemoveClick = {},
90+
)
91+
}
92+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="19dp"
3+
android:height="18dp"
4+
android:viewportWidth="19"
5+
android:viewportHeight="18">
6+
<path
7+
android:pathData="M9.469,9m-9,0a9,9 0,1 1,18 0a9,9 0,1 1,-18 0"
8+
android:fillColor="#EEEEF2"/>
9+
<path
10+
android:strokeWidth="1"
11+
android:pathData="M12.469,6L6.469,12"
12+
android:fillColor="#00000000"
13+
android:strokeColor="#949399"
14+
android:strokeLineCap="round"/>
15+
<path
16+
android:strokeWidth="1"
17+
android:pathData="M6.469,6L12.469,12"
18+
android:fillColor="#00000000"
19+
android:strokeColor="#949399"
20+
android:strokeLineCap="round"/>
21+
</vector>

0 commit comments

Comments
 (0)