Skip to content

Commit

Permalink
Merge branch 'develop' into feature/comet/contentalpha
Browse files Browse the repository at this point in the history
  • Loading branch information
cometj03 authored Jan 15, 2024
2 parents 5eaacdf + 53a7a5e commit 28af70d
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ReadOnlyComposable
import com.yourssu.design.system.compose.base.ProvideTextStyle
import com.yourssu.design.system.compose.foundation.LocalContentColor
import com.yourssu.design.system.compose.foundation.LocalYdsContentColor
import com.yourssu.design.system.compose.foundation.LocalYdsColorScheme
import com.yourssu.design.system.compose.foundation.LocalYdsTypography
import com.yourssu.design.system.compose.foundation.YdsColorScheme
Expand All @@ -26,7 +26,7 @@ fun YdsTheme(
CompositionLocalProvider(
LocalYdsColorScheme provides colors,
LocalYdsTypography provides typography,
LocalContentColor provides colors.textPrimary,
LocalYdsContentColor provides colors.textPrimary,
) {
ProvideTextStyle(value = typography.body1) {
content()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.yourssu.design.system.compose.YdsTheme
import com.yourssu.design.system.compose.rule.Duration
import com.yourssu.design.system.compose.rule.YdsInAndOutEasing
import com.yourssu.design.system.compose.rule.YdsEasing
import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterialApi::class)
Expand All @@ -23,7 +23,7 @@ fun rememberYdsBottomSheetState(): ModalBottomSheetState {
initialValue = ModalBottomSheetValue.Hidden,
animationSpec = tween(
durationMillis = Duration.Medium.millis,
easing = YdsInAndOutEasing
easing = YdsEasing
),
skipHalfExpanded = true
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import com.yourssu.design.system.compose.YdsTheme
import com.yourssu.design.system.compose.base.IconSize
import com.yourssu.design.system.compose.base.YdsText
import com.yourssu.design.system.compose.base.Icon
import com.yourssu.design.system.compose.base.noRippleClickable
import com.yourssu.design.system.compose.base.ydsClickable
import com.yourssu.design.system.compose.states.ButtonSizeState

enum class CheckBoxSize {
Expand Down Expand Up @@ -84,7 +84,7 @@ fun CheckBox(
val betweenSpace = sizeState.betweenSpace

val clickableModifier = if (isDisabled) Modifier else
Modifier.noRippleClickable(interactionSource) { onCheckedChange(!checked) }
Modifier.ydsClickable(interactionSource) { onCheckedChange(!checked) }

Row(
modifier = modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.yourssu.design.system.compose.R
import com.yourssu.design.system.compose.YdsTheme
import com.yourssu.design.system.compose.base.YdsText
import com.yourssu.design.system.compose.base.Icon
import com.yourssu.design.system.compose.base.noRippleClickable
import com.yourssu.design.system.compose.base.ydsClickable

@Composable
fun ListItem(
Expand All @@ -46,7 +46,7 @@ fun ListItem(
modifier = modifier
.fillMaxWidth()
.height(48.dp)
.noRippleClickable(interactionSource) {
.ydsClickable(interactionSource) {
if (!isDisabled) {
onClick()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.yourssu.design.system.compose.YdsTheme
import com.yourssu.design.system.compose.base.noRippleClickable
import com.yourssu.design.system.compose.rule.YdsInAndOutEasing
import com.yourssu.design.system.compose.base.ydsClickable
import com.yourssu.design.system.compose.rule.YdsEasing
import com.yourssu.design.system.compose.rule.YdsBorder

@Composable
Expand All @@ -49,15 +49,15 @@ fun Toggle(
transitionSpec = {
tween(
durationMillis = 100,
easing = YdsInAndOutEasing
easing = YdsEasing
)
}
) { selected ->
if (selected) 10.dp else (-10).dp
}

val clickableModifier = if (isDisabled) modifier else
modifier.noRippleClickable(interactionSource) { onCheckedChange(!checked) }
modifier.ydsClickable(interactionSource) { onCheckedChange(!checked) }

Box(
modifier = modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.yourssu.design.system.compose.foundation.LocalContentColor
import com.yourssu.design.system.compose.foundation.LocalYdsContentColor

sealed class IconSize(val value: Dp) {
object ExtraSmall : IconSize(16.dp)
Expand All @@ -30,7 +30,7 @@ fun Icon(
@DrawableRes id: Int,
modifier: Modifier = Modifier,
iconSize: IconSize = IconSize.Medium,
tint: Color = LocalContentColor.current,
tint: Color = LocalYdsContentColor.current,
) {
Icon(
imageVector = ImageVector.vectorResource(id = id),
Expand All @@ -45,7 +45,7 @@ fun Icon(
imageVector: ImageVector,
modifier: Modifier = Modifier,
iconSize: IconSize = IconSize.Medium,
tint: Color = LocalContentColor.current,
tint: Color = LocalYdsContentColor.current,
) {
Icon(
painter = rememberVectorPainter(imageVector),
Expand All @@ -60,7 +60,7 @@ fun Icon(
painter: Painter,
modifier: Modifier = Modifier,
iconSize: IconSize = IconSize.Medium,
tint: Color = LocalContentColor.current,
tint: Color = LocalYdsContentColor.current,
) {
val colorFilter = ColorFilter.tint(tint)
Box(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ import androidx.compose.ui.semantics.isContainer
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.Dp
import com.yourssu.design.system.compose.YdsTheme
import com.yourssu.design.system.compose.foundation.LocalContentColor
import com.yourssu.design.system.compose.foundation.LocalYdsContentColor

@Composable
fun Surface(
modifier: Modifier = Modifier,
rounding: Dp? = null,
shape: Shape = rounding?.let { RoundedCornerShape(it) } ?: RectangleShape,
color: Color = YdsTheme.colors.bgNormal,
contentColor: Color = LocalContentColor.current,
contentColor: Color = LocalYdsContentColor.current,
border: BorderStroke? = null,
content: @Composable () -> Unit,
) {
CompositionLocalProvider(
LocalContentColor provides contentColor,
LocalYdsContentColor provides contentColor,
) {
Box(
modifier = modifier
Expand Down Expand Up @@ -65,13 +65,13 @@ fun Surface(
rounding: Dp? = null,
shape: Shape = rounding?.let { RoundedCornerShape(it) } ?: RectangleShape,
color: Color = YdsTheme.colors.bgNormal,
contentColor: Color = LocalContentColor.current,
contentColor: Color = LocalYdsContentColor.current,
border: BorderStroke? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
content: @Composable () -> Unit,
) {
CompositionLocalProvider(
LocalContentColor provides contentColor,
LocalYdsContentColor provides contentColor,
) {
Box(
modifier = modifier
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.yourssu.design.system.compose.base

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.ui.Modifier

/**
* (전) noRippleClickable
*
* ripple 효과가 없는 clickable입니다.
*/
inline fun Modifier.ydsClickable(
interactionSource: MutableInteractionSource,
enabled: Boolean = true,
crossinline onClick: () -> Unit,
): Modifier = this.clickable(
interactionSource = interactionSource,
indication = null,
enabled = enabled,
) {
onClick()
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import com.yourssu.design.system.compose.R
import com.yourssu.design.system.compose.YdsTheme
import com.yourssu.design.system.compose.atom.BoxButton
import com.yourssu.design.system.compose.atom.TopBarButton
import com.yourssu.design.system.compose.component.topbar.TopBar
import com.yourssu.design.system.compose.component.toast.ToastDuration
import com.yourssu.design.system.compose.component.toast.ToastHost
import com.yourssu.design.system.compose.component.toast.ToastHostState
import com.yourssu.design.system.compose.component.toast.rememberToastHostState
import com.yourssu.design.system.compose.foundation.LocalContentColor
import com.yourssu.design.system.compose.component.topbar.TopBar
import com.yourssu.design.system.compose.foundation.LocalYdsContentColor
import kotlinx.coroutines.launch

private enum class ScaffoldLayoutContent { TopBar, MainContent, Snackbar, BottomBar }
Expand All @@ -38,15 +38,15 @@ fun YdsScaffold(
bottomBar: @Composable () -> Unit = {},
toastHost: @Composable (ToastHostState) -> Unit = { ToastHost(it) },
backgroundColor: Color = YdsTheme.colors.bgNormal,
contentColor: Color = LocalContentColor.current,
content: @Composable (PaddingValues) -> Unit
contentColor: Color = LocalYdsContentColor.current,
content: @Composable (PaddingValues) -> Unit,
) {
Surface(modifier = modifier, color = backgroundColor, contentColor = contentColor) {
ScaffoldLayout(
topBar = topBar,
bottomBar = bottomBar,
toast = { toastHost(toastHostState) },
content = content
content = content,
)
}
}
Expand All @@ -56,7 +56,7 @@ private fun ScaffoldLayout(
topBar: @Composable () -> Unit,
bottomBar: @Composable () -> Unit,
toast: @Composable () -> Unit,
content: @Composable (PaddingValues) -> Unit
content: @Composable (PaddingValues) -> Unit,
) {
val pxValue = LocalDensity.current.run { ToastApartFromBottom.toPx() }.toInt()

Expand Down Expand Up @@ -149,12 +149,12 @@ private fun YdsScaffoldPreview() {
scope.launch {
toastHostState.showToast(
message = "Snackbar",
duration = ToastDuration.SHORT
duration = ToastDuration.SHORT,
)
}
}
},
)
}
},
)
},
bottomBar = {
Expand All @@ -167,7 +167,7 @@ private fun YdsScaffoldPreview() {
YdsText(
text = "This is 72.dp",
style = YdsTheme.typography.body1,
color = Color.White
color = Color.White,
)
}
},
Expand All @@ -176,27 +176,33 @@ private fun YdsScaffoldPreview() {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize()
modifier = Modifier.fillMaxSize(),
) {
YdsText(text = "content", style = YdsTheme.typography.body1)
BoxButton(onClick = {
scope.launch {
toastHostState.showToast(
message = "잠, 아스라히 노새, 멀듯이, 흙으로 봅니다.",
duration = ToastDuration.SHORT
)
}
}, text = "짧은 토스트 버튼")
BoxButton(onClick = {
scope.launch {
toastHostState.showToast(
message = "잠, 아스라히 노새, 멀듯이, 흙으로 봅니다. 때 불러 가슴속에 나의 풀이 이름과 언덕 오면 가을 봅니다.",
duration = ToastDuration.LONG
)
}
}, text = "긴 토스트 버튼")
BoxButton(
onClick = {
scope.launch {
toastHostState.showToast(
message = "잠, 아스라히 노새, 멀듯이, 흙으로 봅니다.",
duration = ToastDuration.SHORT,
)
}
},
text = "짧은 토스트 버튼",
)
BoxButton(
onClick = {
scope.launch {
toastHostState.showToast(
message = "잠, 아스라히 노새, 멀듯이, 흙으로 봅니다. 때 불러 가슴속에 나의 풀이 이름과 언덕 오면 가을 봅니다.",
duration = ToastDuration.LONG,
)
}
},
text = "긴 토스트 버튼",
)
}
}
},
)
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.takeOrElse
import androidx.compose.ui.text.TextLayoutResult
import com.yourssu.design.system.compose.foundation.LocalContentColor
import com.yourssu.design.system.compose.foundation.LocalYdsContentAlpha
import com.yourssu.design.system.compose.foundation.LocalYdsContentColor
import com.yourssu.design.system.compose.foundation.YdsTextStyle

@Composable
Expand All @@ -22,7 +22,7 @@ fun YdsText(
) {
val textColor = color.takeOrElse {
style.color.takeOrElse {
LocalContentColor.current.copy(alpha = LocalYdsContentAlpha.current)
LocalYdsContentColor.current.copy(alpha = LocalYdsContentAlpha.current)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import com.yourssu.design.system.compose.base.Surface
import com.yourssu.design.system.compose.base.YdsScaffold
import com.yourssu.design.system.compose.base.YdsText
import com.yourssu.design.system.compose.component.topbar.TopBar
import com.yourssu.design.system.compose.rule.YdsInAndOutEasing
import com.yourssu.design.system.compose.rule.YdsEasing

/**
* 하단 네비게이션 바
Expand Down Expand Up @@ -126,7 +126,7 @@ fun RowScope.BottomBarItem(
targetValue = if (isAnimating) 1.2f else 1f, // isAnimating 에 따라 scale 기본값(1f) ~ 1.2배 까지 변화
animationSpec = tween(
durationMillis = 25,
easing = YdsInAndOutEasing,
easing = YdsEasing,
),
finishedListener = {// animating 끝나면 false로 변경. scale 1.2f -> 1f로 변화
if (isAnimating) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
import com.yourssu.design.system.compose.rule.Duration
import com.yourssu.design.system.compose.rule.YdsInAndOutEasing
import com.yourssu.design.system.compose.rule.YdsEasing

data class ToastTransitionItem(
val toastData: ToastData?,
Expand Down Expand Up @@ -62,7 +62,7 @@ fun FadeInFadeOut(
val isVisible = appearedToastData == newToastData
val opacity = animatedOpacity(
animation = tween(
easing = YdsInAndOutEasing,
easing = YdsEasing,
delayMillis = 0,
durationMillis = Duration.Medium.millis
),
Expand Down
Loading

0 comments on commit 28af70d

Please sign in to comment.