Skip to content

Commit

Permalink
♻️ :: shadow 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JunJaBoy committed Apr 16, 2024
1 parent 5179417 commit c1a95c2
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

fun Modifier.shadow(
elevation: Dp = ShadowDefaults.SmallElevation,
elevation: Dp = ShadowDefaults.MediumElevation,
shape: Shape = ShadowDefaults.RoundedShape,
clip: Boolean = elevation > 0.dp,
ambientColor: Color? = null,
Expand All @@ -20,8 +20,10 @@ fun Modifier.shadow(
elevation = elevation,
shape = shape,
clip = clip,
ambientColor = ambientColor ?: DmsTheme.colorScheme.surfaceVariant,
spotColor = spotColor ?: DmsTheme.colorScheme.surfaceVariant,
ambientColor = ambientColor
?: DmsTheme.colorScheme.onSurfaceVariant.copy(alpha = ShadowDefaults.DefaultAlpha),
spotColor = spotColor
?: DmsTheme.colorScheme.onSurfaceVariant.copy(alpha = ShadowDefaults.DefaultAlpha),
)
}

Expand All @@ -30,5 +32,7 @@ object ShadowDefaults {
val MediumElevation = 4.dp
val LargeElevation = 8.dp

val RoundedShape = RoundedCornerShape(8.dp)
const val DefaultAlpha = 0.6f

val RoundedShape = RoundedCornerShape(12.dp)
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fun Modifier.bottomPadding(
value: Dp = PaddingDefaults.Medium,
): Modifier = padding(bottom = value)

val DefaultVerticalSpace = PaddingDefaults.Small
val DefaultVerticalSpace = PaddingDefaults.Medium

val LargeVerticalSpace = PaddingDefaults.Medium

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import team.aliens.dms.android.core.designsystem.DmsTopAppBar
import team.aliens.dms.android.core.designsystem.OutlinedButton
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.clickable
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultVerticalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
import team.aliens.dms.android.core.ui.bottomPadding
Expand Down Expand Up @@ -144,13 +145,13 @@ private fun NoticeCard(
Card(
modifier = modifier
.horizontalPadding()
.verticalPadding(PaddingDefaults.ExtraSmall),
.verticalPadding(PaddingDefaults.ExtraSmall)
.shadow(),
shape = DmsTheme.shapes.surfaceSmall,
colors = CardDefaults.cardColors(
containerColor = DmsTheme.colorScheme.surface,
contentColor = DmsTheme.colorScheme.onSurface,
),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = ShadowDefaults.SmallElevation),
) {
Column(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import team.aliens.dms.android.core.designsystem.DmsTopAppBar
import team.aliens.dms.android.core.designsystem.RoundedButton
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultVerticalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
import team.aliens.dms.android.core.ui.bottomPadding
Expand Down Expand Up @@ -110,13 +111,13 @@ private fun ApplicationCard(
modifier = modifier
.animateContentSize()
.horizontalPadding()
.verticalPadding(),
.verticalPadding()
.shadow(),
shape = DmsTheme.shapes.surfaceSmall,
colors = CardDefaults.cardColors(
colors = CardDefaults.elevatedCardColors(
containerColor = DmsTheme.colorScheme.surface,
contentColor = DmsTheme.colorScheme.onSurface,
),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = ShadowDefaults.SmallElevation),
) {
Column(
verticalArrangement = Arrangement.spacedBy(DefaultVerticalSpace),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ import org.threeten.bp.DayOfWeek
import org.threeten.bp.LocalDate
import team.aliens.dms.android.core.designsystem.ButtonDefaults
import team.aliens.dms.android.core.designsystem.DmsCalendar
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.DmsTheme
import team.aliens.dms.android.core.designsystem.DmsTopAppBar
import team.aliens.dms.android.core.designsystem.LocalToast
import team.aliens.dms.android.core.designsystem.ModalBottomSheet
import team.aliens.dms.android.core.designsystem.OutlinedButton
import team.aliens.dms.android.core.designsystem.PrimaryDefault
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.TextButton
import team.aliens.dms.android.core.designsystem.clickable
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultHorizontalSpace
import team.aliens.dms.android.core.ui.DefaultVerticalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
Expand Down Expand Up @@ -546,7 +547,11 @@ private fun MealCard(
}
}
}
},
}
.shadow(
ambientColor = DmsTheme.colorScheme.primary.copy(alpha = ShadowDefaults.DefaultAlpha),
spotColor = DmsTheme.colorScheme.primary.copy(alpha = ShadowDefaults.DefaultAlpha),
),
shape = DmsTheme.shapes.surfaceLarge,
colors = CardDefaults.outlinedCardColors(
containerColor = DmsTheme.colorScheme.surface,
Expand All @@ -556,7 +561,6 @@ private fun MealCard(
width = 1.dp,
color = DmsTheme.colorScheme.primary,
),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = ShadowDefaults.SmallElevation),
) {
val dishes = when (currentCardType) {
BREAKFAST -> breakfast
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.ramcosta.composedestinations.annotation.Destination
import team.aliens.dms.android.core.designsystem.AlertDialog
import team.aliens.dms.android.core.designsystem.ButtonDefaults
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.DmsTheme
import team.aliens.dms.android.core.designsystem.DmsTopAppBar
import team.aliens.dms.android.core.designsystem.Gray10
import team.aliens.dms.android.core.designsystem.RoundedButton
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.TextButton
import team.aliens.dms.android.core.designsystem.clickable
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultHorizontalSpace
import team.aliens.dms.android.core.ui.LargeVerticalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
Expand Down Expand Up @@ -385,7 +386,8 @@ private fun PointCard(

@Immutable
private enum class PointCardType {
BONUS, MINUS, ;
BONUS, MINUS,
;

val containerColor: Color
@Composable inline get() = when (this) {
Expand Down Expand Up @@ -493,13 +495,14 @@ private fun OptionLayout(
titleColor: Color,
) {
Card(
modifier = modifier.horizontalPadding(),
modifier = modifier
.horizontalPadding()
.shadow(),
shape = DmsTheme.shapes.surfaceSmall,
colors = CardDefaults.cardColors(
containerColor = DmsTheme.colorScheme.surface,
contentColor = titleColor,
),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = ShadowDefaults.SmallElevation),
) {
options.forEachIndexed { index, option ->
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import team.aliens.dms.android.core.designsystem.DmsTheme
import team.aliens.dms.android.core.designsystem.DmsTopAppBar
import team.aliens.dms.android.core.designsystem.LocalToast
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.TextButton
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultHorizontalSpace
import team.aliens.dms.android.core.ui.DefaultVerticalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
Expand Down Expand Up @@ -176,13 +176,13 @@ private fun OutingInformationCard(
Card(
modifier = modifier
.horizontalPadding()
.verticalPadding(PaddingDefaults.ExtraSmall),
.verticalPadding(PaddingDefaults.ExtraSmall)
.shadow(),
shape = DmsTheme.shapes.surfaceMedium,
colors = CardDefaults.cardColors(
containerColor = DmsTheme.colorScheme.surface,
contentColor = DmsTheme.colorScheme.onSurface,
),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = ShadowDefaults.SmallElevation),
) {
Column(
modifier = Modifier.fillMaxWidth(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import team.aliens.dms.android.core.designsystem.DmsTheme
import team.aliens.dms.android.core.designsystem.DmsTopAppBar
import team.aliens.dms.android.core.designsystem.OutlinedButton
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.VerticallyFadedLazyColumn
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultHorizontalSpace
import team.aliens.dms.android.core.ui.DefaultVerticalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
Expand Down Expand Up @@ -174,13 +174,13 @@ private fun PointCard(
Card(
modifier = modifier
.horizontalPadding()
.verticalPadding(PaddingDefaults.ExtraSmall),
.verticalPadding(PaddingDefaults.ExtraSmall)
.shadow(),
shape = DmsTheme.shapes.surfaceSmall,
colors = CardDefaults.cardColors(
containerColor = DmsTheme.colorScheme.surface,
contentColor = DmsTheme.colorScheme.onSurface,
),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = ShadowDefaults.SmallElevation),
) {
Column(
verticalArrangement = Arrangement.spacedBy(DefaultVerticalSpace),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import team.aliens.dms.android.core.designsystem.RoundedButton
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.clickable
import team.aliens.dms.android.core.designsystem.VerticallyFadedLazyColumn
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultHorizontalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
import team.aliens.dms.android.core.ui.bottomPadding
Expand Down Expand Up @@ -196,20 +197,13 @@ private fun RemainsOptionCard(
Card(
modifier = modifier
.horizontalPadding()
.verticalPadding(PaddingDefaults.ExtraSmall),
.verticalPadding(PaddingDefaults.ExtraSmall)
.shadow(),
shape = DmsTheme.shapes.surfaceSmall,
colors = CardDefaults.cardColors(
containerColor = DmsTheme.colorScheme.surface,
contentColor = DmsTheme.colorScheme.onSurface,
),
elevation = CardDefaults.outlinedCardElevation(
defaultElevation =
if (selected) {
ShadowDefaults.MediumElevation
} else {
ShadowDefaults.SmallElevation
},
),
border = if (selected) {
BorderStroke(
width = 1.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import team.aliens.dms.android.core.designsystem.DmsTheme
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultHorizontalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
import team.aliens.dms.android.core.ui.endPadding
Expand All @@ -26,7 +27,6 @@ import team.aliens.dms.android.feature.R
import team.aliens.dms.android.shared.model.Sex


@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun StudyRoomCard(
modifier: Modifier = Modifier,
Expand All @@ -36,13 +36,13 @@ fun StudyRoomCard(
Card(
modifier = modifier
.horizontalPadding()
.verticalPadding(PaddingDefaults.ExtraSmall),
.verticalPadding(PaddingDefaults.ExtraSmall)
.shadow(),
shape = DmsTheme.shapes.surfaceSmall,
colors = CardDefaults.cardColors(
containerColor = DmsTheme.colorScheme.surface,
contentColor = DmsTheme.colorScheme.onSurface,
),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = ShadowDefaults.SmallElevation),
onClick = onClick,
) {
Column {
Expand Down

0 comments on commit c1a95c2

Please sign in to comment.