Skip to content

Commit

Permalink
[feat] : #3 이미지+텍스트 겹침 Box 컴포넌트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
1971123-seongmin committed Oct 25, 2024
1 parent c5a1448 commit 706497c
Showing 1 changed file with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.sopt.and.presentation.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
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.res.painterResource
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import org.sopt.and.ui.theme.White

@Composable
fun BoxOverlayImage(
imageRes: Int,
overlayText: String,
modifier: Modifier = Modifier
) {
Box(
modifier = modifier
.width(180.dp)
.height(220.dp)
.clip(RoundedCornerShape(12.dp))
) {
// 이미지
Image(
painter = painterResource(id = imageRes),
contentDescription = "Overlay Image",
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize()
)
// overlayText
Text(
text = overlayText,
color = White,
fontSize = 48.sp,
fontWeight = FontWeight.Bold,
fontStyle = FontStyle.Italic,
modifier = Modifier
.align(Alignment.BottomStart)
.padding(8.dp, top = 16.dp)
)
}
}

0 comments on commit 706497c

Please sign in to comment.