diff --git a/app/src/main/java/com/b1nd/dodam/designsystem/MainActivity.kt b/app/src/main/java/com/b1nd/dodam/designsystem/MainActivity.kt index 020d7ed..d587675 100644 --- a/app/src/main/java/com/b1nd/dodam/designsystem/MainActivity.kt +++ b/app/src/main/java/com/b1nd/dodam/designsystem/MainActivity.kt @@ -3,6 +3,7 @@ package com.b1nd.dodam.designsystem import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -47,6 +48,11 @@ class MainActivity : ComponentActivity() { imageVector = DodamIcons.Chart.value, contentDescription = null ) + DodamAvatar( + model = null, + avatarSize = AvatarSize.ExtraLarge, + borderStroke = BorderStroke(1.dp, DodamTheme.colors.lineAlternative) + ) } } } diff --git a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Avatar.kt b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Avatar.kt index e13adf3..bcde259 100644 --- a/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Avatar.kt +++ b/dodam-design-system/src/commonMain/kotlin/com/b1nd/dodam/designsystem/component/Avatar.kt @@ -1,7 +1,9 @@ package com.b1nd.dodam.designsystem.component +import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.Image import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape @@ -20,6 +22,7 @@ import coil3.compose.AsyncImage import coil3.request.ImageRequest import com.b1nd.dodam.designsystem.DodamTheme import com.b1nd.dodam.designsystem.foundation.DodamIcons +import com.b1nd.dodam.designsystem.internal.`if` @Composable @@ -30,6 +33,7 @@ fun DodamAvatar( contentDescription: String? = null, colorFilter: ColorFilter? = null, alpha: Float = DefaultAlpha, + borderStroke: BorderStroke? = null, contentScale: ContentScale = ContentScale.Fit, ) { @@ -40,7 +44,13 @@ fun DodamAvatar( DodamAsyncAvatar( modifier = modifier .size(avatarConfig.backgroundSize) - .clip(CircleShape), + .clip(CircleShape) + .`if`(borderStroke != null) { + border( + border = borderStroke!!, + shape = CircleShape + ) + }, model = model, contentDescription = contentDescription, colorFilter = colorFilter, @@ -56,6 +66,13 @@ fun DodamAvatar( color = DodamTheme.colors.fillNormal, shape = CircleShape ) + .`if`(borderStroke != null) { + border( + border = borderStroke!!, + shape = CircleShape + ) + } + ) { Image( modifier = Modifier @@ -79,7 +96,7 @@ private fun DodamAsyncAvatar( contentDescription: String?, colorFilter: ColorFilter?, alpha: Float, - contentScale: ContentScale + contentScale: ContentScale, ) { AsyncImage( modifier = modifier, @@ -87,7 +104,7 @@ private fun DodamAsyncAvatar( contentDescription = contentDescription, colorFilter = colorFilter, alpha = alpha, - contentScale = contentScale + contentScale = contentScale, ) }