Skip to content

Commit

Permalink
[feat] #26 shadow 적용, shadow 확장함수 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
beom84 committed Jan 15, 2025
1 parent deb4167 commit a51cc6b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.android.bbangzip.presentation.type.BbangZipShadowType
import org.android.bbangzip.presentation.util.modifier.applyShadows
import org.android.bbangzip.ui.theme.BbangZipTheme

@Composable
Expand All @@ -25,6 +27,7 @@ fun BalloonContainer(
Box(
modifier =
modifier
.applyShadows(BbangZipShadowType.STRONG, shape = RoundedCornerShape(size = 20.dp))
.fillMaxWidth()
.background(
color = BbangZipTheme.colors.staticWhite_FFFFFF,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private fun TopBalloonPreview() {
Column(
Modifier
.fillMaxSize()
.background(color = defaultBbangZipColors.staticBlack_000000),
.background(color = defaultBbangZipColors.backgroundAccent_FFDAA0),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Spacer(modifier = Modifier.height(10.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import org.android.bbangzip.presentation.type.BbangZipShadowType

@Composable
fun Modifier.noRippleClickable(
Expand Down Expand Up @@ -63,3 +64,13 @@ fun Modifier.dropShadow(
canvas.restore()
}
}

@Composable
fun Modifier.applyShadows(
shadowType: BbangZipShadowType,
shape: Shape,
): Modifier {
return shadowType.shadowOptions.fold(this) { acc, shadowOption ->
acc.dropShadow(shape = shape, color = shadowOption.color, blur = shadowOption.blur, offsetY = shadowOption.offsetY, offsetX = shadowOption.offsetX, spread = shadowOption.spread)
}
}

0 comments on commit a51cc6b

Please sign in to comment.