Skip to content

Commit

Permalink
feature #866: wrapping AsyncImage to UrlImage
Browse files Browse the repository at this point in the history
  • Loading branch information
chattymin authored and l2hyunwoo committed Sep 24, 2024
1 parent a9734b0 commit c21e81c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.sopt.official.feature.fortune.component

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import coil.compose.AsyncImage

@Composable
fun UrlImage(
url: String,
modifier: Modifier = Modifier,
contentDescription: String? = null,
) {
AsyncImage(
model = url,
contentDescription = contentDescription,
modifier = modifier
)
}

@Preview
@Composable
fun UrlImagePreview() {
UrlImage(
url = ""
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@ import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import kotlinx.serialization.Serializable
import org.sopt.official.designsystem.SoptTheme
import org.sopt.official.feature.fortune.component.CircleShapeBorderButton
import org.sopt.official.feature.fortune.component.UrlImage

@Composable
internal fun FortuneAmuletRoute(
paddingValue: PaddingValues,
navigateToHome: () -> Unit
navigateToHome: () -> Unit,
) {
FortuneAmuletScreen(
paddingValue = paddingValue,
Expand All @@ -60,7 +59,7 @@ internal fun FortuneAmuletRoute(
@Composable
private fun FortuneAmuletScreen(
paddingValue: PaddingValues,
navigateToHome: () -> Unit
navigateToHome: () -> Unit,
) {
Column(
modifier = Modifier
Expand Down Expand Up @@ -92,8 +91,8 @@ private fun FortuneAmuletScreen(
)
Spacer(modifier = Modifier.height(34.dp))

AsyncImage(
model = "https://어쩌구저쩌구/test_fortune_card.png", // 서버에서 받아온 이미지
UrlImage(
url = "https://어쩌구저쩌구/test_fortune_card.png", // 서버에서 받아온 이미지
contentDescription = null,
modifier = Modifier
.padding(horizontal = 33.dp)
Expand Down

0 comments on commit c21e81c

Please sign in to comment.