@@ -17,9 +17,8 @@ import androidx.compose.ui.draw.clip
1717import androidx.compose.ui.graphics.Color
1818import androidx.compose.ui.graphics.vector.ImageVector
1919import androidx.compose.ui.layout.ContentScale
20- import androidx.compose.ui.res.vectorResource
2120import androidx.compose.ui.res.painterResource
22- import androidx.compose.ui.unit.Dp
21+ import androidx.compose.ui.res.vectorResource
2322import androidx.compose.ui.unit.dp
2423import coil3.compose.AsyncImage
2524import com.neki.android.core.designsystem.ComponentPreview
@@ -29,23 +28,26 @@ import com.neki.android.core.designsystem.ui.theme.NekiTheme
2928import com.neki.android.core.ui.compose.VerticalSpacer
3029
3130@Composable
32- internal fun SettingProfileImage (
33- nickname : String ,
34- profileImage : String = "",
35- imageSize : Dp = 142.dp,
36- onClickEdit : () -> Unit ,
31+ internal fun ProfileImage (
32+ profileImage : Any? = null,
33+ nickname : String = "",
3734 onClickCameraIcon : () -> Unit ,
35+ onClickEdit : () -> Unit = {},
3836) {
3937 Column (
40- modifier = Modifier .padding(top = 20 .dp, bottom = 27 .dp),
38+ modifier = Modifier
39+ .padding(
40+ top = 20 .dp,
41+ bottom = if (nickname.isNotEmpty()) 34 .dp else 28 .dp
42+ ),
4143 horizontalAlignment = Alignment .CenterHorizontally ,
4244 ) {
4345 Box {
4446 AsyncImage (
4547 modifier = Modifier
46- .size(imageSize )
48+ .size(142 .dp )
4749 .clip(CircleShape ),
48- model = profileImage.ifEmpty { R .drawable.image_profile_empty } ,
50+ model = profileImage ? : R .drawable.image_profile_empty,
4951 contentDescription = null ,
5052 contentScale = ContentScale .Crop ,
5153 placeholder = painterResource(R .drawable.image_profile_empty),
@@ -69,33 +71,45 @@ internal fun SettingProfileImage(
6971 )
7072 }
7173 }
72- VerticalSpacer (16 .dp)
73- Row (
74- horizontalArrangement = Arrangement .spacedBy(8 .dp, Alignment .CenterHorizontally ),
75- verticalAlignment = Alignment .CenterVertically ,
76- ) {
77- Text (
78- text = nickname,
79- style = NekiTheme .typography.title20Medium,
80- color = NekiTheme .colorScheme.gray900,
81- )
82- Icon (
83- modifier = Modifier .noRippleClickableSingle(onClick = onClickEdit),
84- imageVector = ImageVector .vectorResource(R .drawable.icon_edit),
85- contentDescription = null ,
86- tint = Color .Unspecified ,
87- )
74+ if (nickname.isNotEmpty()) {
75+ VerticalSpacer (16 .dp)
76+ Row (
77+ horizontalArrangement = Arrangement .spacedBy(8 .dp, Alignment .CenterHorizontally ),
78+ verticalAlignment = Alignment .CenterVertically ,
79+ ) {
80+ Text (
81+ text = nickname,
82+ style = NekiTheme .typography.title20Medium,
83+ color = NekiTheme .colorScheme.gray900,
84+ )
85+ Icon (
86+ modifier = Modifier .noRippleClickableSingle(onClick = onClickEdit),
87+ imageVector = ImageVector .vectorResource(R .drawable.icon_edit),
88+ contentDescription = null ,
89+ tint = Color .Unspecified ,
90+ )
91+ }
8892 }
8993 }
9094}
9195
9296@ComponentPreview
9397@Composable
94- private fun SettingProfileImagePreview () {
98+ private fun ProfileImageWithNicknamePreview () {
9599 NekiTheme {
96- SettingProfileImage (
100+ ProfileImage (
97101 nickname = " 네키네키" ,
102+ onClickCameraIcon = {},
98103 onClickEdit = {},
104+ )
105+ }
106+ }
107+
108+ @ComponentPreview
109+ @Composable
110+ private fun ProfileImagePreview () {
111+ NekiTheme {
112+ ProfileImage (
99113 onClickCameraIcon = {},
100114 )
101115 }
0 commit comments