Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tmdhoon2 committed Feb 8, 2024
2 parents a720809 + 62259f2 commit 6d8485d
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 60 deletions.
2 changes: 1 addition & 1 deletion jobisdesignsystemv2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ afterEvaluate {
from(components["release"])
groupId = "team.return.jobis.android"
artifactId = "design-system-v2"
version = "1.1.1"
version = "1.1.2"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ class JobisButtonTest {

composeRule.runOnIdle { assert(clicked == 1) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class JobisTextFieldTest {
informationDescription = informationDescription,
descriptionType = type,
showDescription = { true },
modifier = Modifier.clickable { text = "text" }
modifier = Modifier.clickable { text = "text" },
)
}

Expand All @@ -70,4 +70,4 @@ class JobisTextFieldTest {

composeRule.runOnIdle { assert(type == DescriptionType.Error) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class JobisTextTest {
JobisText(
text = TEXT_TEST_TAG,
style = style,
modifier = Modifier.clickable { style = JobisTypography.Caption }
modifier = Modifier.clickable { style = JobisTypography.Caption },
)
}
val test = composeRule.onNodeWithText(TEXT_TEST_TAG).assertIsDisplayed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ private fun BasicTopAppBar(
Box(
modifier = modifier
.fillMaxWidth()
.background(JobisTheme.colors.background),
.background(JobisTheme.colors.background)
.padding(horizontal = 24.dp),
contentAlignment = Alignment.TopCenter,
) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
if(showLogo){
if (showLogo) {
Image(
modifier = Modifier.padding(vertical = 12.dp),
painter = painterResource(id = R.drawable.img_jobis),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,27 @@ import team.returm.jobisdesignsystemv2.utils.keyboardAsState
private val largeButtonShape = RoundedCornerShape(12.dp)
private val smallButtonShape = RoundedCornerShape(8.dp)

private enum class ButtonType {
LARGE,
SMALL,
}

@Composable
private fun BasicButton(
modifier: Modifier,
backgroundColor: Color,
shape: RoundedCornerShape,
enabled: Boolean,
buttonType: ButtonType,
keyboardInteractionEnabled: Boolean,
onPressed: (pressed: Boolean) -> Unit,
onClick: () -> Unit,
content: @Composable () -> Unit,
) {
val keyboardShow by keyboardAsState()
val padding = if (keyboardShow) {
val isKeyboardHideButton =
keyboardShow && keyboardInteractionEnabled
val padding = if (isKeyboardHideButton || buttonType == ButtonType.SMALL) {
PaddingValues(
vertical = 0.dp,
horizontal = 0.dp,
Expand All @@ -62,7 +71,7 @@ private fun BasicButton(
horizontal = 24.dp,
)
}
val (shapeByKeyboardShow, pressDepth) = if (keyboardShow) {
val (shapeByKeyboardShow, pressDepth) = if (isKeyboardHideButton) {
RoundedCornerShape(0.dp) to MIN_PRESS_DEPTH
} else {
shape to DEFAULT_PRESS_DEPTH
Expand All @@ -77,7 +86,7 @@ private fun BasicButton(
onClick = onClick,
)
.padding(padding)
.imePadding(),
.then(if (keyboardInteractionEnabled) Modifier.imePadding() else Modifier),
shape = shapeByKeyboardShow,
color = backgroundColor,
content = content,
Expand All @@ -90,6 +99,8 @@ private fun ColoredButton(
color: ButtonColor,
shape: RoundedCornerShape,
enabled: Boolean,
buttonType: ButtonType,
keyboardInteractionEnabled: Boolean,
pressed: () -> Boolean,
onPressed: (pressed: Boolean) -> Unit,
onClick: () -> Unit,
Expand Down Expand Up @@ -123,6 +134,8 @@ private fun ColoredButton(
backgroundColor = background,
shape = shape,
enabled = enabled,
buttonType = buttonType,
keyboardInteractionEnabled = keyboardInteractionEnabled,
onPressed = onPressed,
onClick = onClick,
content = { content(contentColor) },
Expand Down Expand Up @@ -165,6 +178,7 @@ private fun LargeButton(
text: String,
color: ButtonColor,
enabled: Boolean,
keyboardInteractionEnabled: Boolean,
onClick: () -> Unit,
) {
var pressed by remember { mutableStateOf(false) }
Expand All @@ -174,6 +188,8 @@ private fun LargeButton(
color = color,
shape = largeButtonShape,
enabled = enabled,
buttonType = ButtonType.LARGE,
keyboardInteractionEnabled = keyboardInteractionEnabled,
pressed = { pressed },
onPressed = { pressed = it },
onClick = onClick,
Expand Down Expand Up @@ -210,6 +226,7 @@ private fun SmallButton(
text: String,
color: ButtonColor,
enabled: Boolean,
keyboardInteractionEnabled: Boolean,
onClick: () -> Unit,
) {
var pressed by remember { mutableStateOf(false) }
Expand All @@ -219,6 +236,8 @@ private fun SmallButton(
color = color,
shape = smallButtonShape,
enabled = enabled,
buttonType = ButtonType.SMALL,
keyboardInteractionEnabled = keyboardInteractionEnabled,
pressed = { pressed },
onPressed = { pressed = it },
onClick = onClick,
Expand All @@ -243,6 +262,7 @@ private fun SmallButton(
* @param text Text to be written on the button
* @param color To color inside this button
* @param enabled Controls the enabled state.
* @param keyboardInteractionEnabled Determines whether the button interacts with the keyboard or not
* @param onClick Called when this button is clicked
*/
@Composable
Expand All @@ -251,13 +271,15 @@ fun JobisButton(
text: String,
color: ButtonColor = ButtonColor.Default,
enabled: Boolean = true,
keyboardInteractionEnabled: Boolean = true,
onClick: () -> Unit,
) {
LargeButton(
modifier = modifier,
text = text,
color = color,
enabled = enabled,
keyboardInteractionEnabled = keyboardInteractionEnabled,
onClick = onClick,
)
}
Expand All @@ -268,13 +290,15 @@ fun JobisSmallButton(
text: String,
color: ButtonColor = ButtonColor.Secondary,
enabled: Boolean = true,
keyboardInteractionEnabled: Boolean = true,
onClick: () -> Unit,
) {
SmallButton(
modifier = modifier,
text = text,
color = color,
enabled = enabled,
keyboardInteractionEnabled = keyboardInteractionEnabled,
onClick = onClick,
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package team.returm.jobisdesignsystemv2.foundation

import androidx.compose.runtime.Composable
import androidx.compose.ui.text.PlatformTextStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
Expand All @@ -8,7 +9,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
import team.returm.jobisdesignsystemv2.R

private val PretendardFamiliy = FontFamily(
private val PretendardFamily = FontFamily(
listOf(
Font(
resId = R.font.pretendard_bold,
Expand All @@ -33,59 +34,73 @@ private val platFormTextStyle = PlatformTextStyle(
* JobisTypography defines fontFamily, fontSize, fontWeight, lineHeight and platformStyle in TextStyle.
*/
object JobisTypography {
val PageTitle = TextStyle(
fontFamily = PretendardFamiliy,
fontSize = 24.sp,
fontWeight = FontWeight.Bold,
lineHeight = 36.sp,
platformStyle = platFormTextStyle,
)
val PageTitle
@Composable get() = TextStyle(
fontFamily = PretendardFamily,
fontSize = 24.sp,
fontWeight = FontWeight.Bold,
lineHeight = 36.sp,
platformStyle = platFormTextStyle,
color = JobisTheme.colors.onBackground,
)

val HeadLine = TextStyle(
fontFamily = PretendardFamiliy,
fontSize = 18.sp,
fontWeight = FontWeight.SemiBold,
lineHeight = 28.sp,
platformStyle = platFormTextStyle,
)
val HeadLine
@Composable get() = TextStyle(
fontFamily = PretendardFamily,
fontSize = 18.sp,
fontWeight = FontWeight.SemiBold,
lineHeight = 28.sp,
platformStyle = platFormTextStyle,
color = JobisTheme.colors.onBackground,
)

val SubHeadLine = TextStyle(
fontFamily = PretendardFamiliy,
fontSize = 16.sp,
fontWeight = FontWeight.SemiBold,
lineHeight = 24.sp,
platformStyle = platFormTextStyle,
)
val SubHeadLine
@Composable get() = TextStyle(
fontFamily = PretendardFamily,
fontSize = 16.sp,
fontWeight = FontWeight.SemiBold,
lineHeight = 24.sp,
platformStyle = platFormTextStyle,
color = JobisTheme.colors.onBackground,
)

val Body = TextStyle(
fontFamily = PretendardFamiliy,
fontSize = 16.sp,
fontWeight = FontWeight.Medium,
lineHeight = 24.sp,
platformStyle = platFormTextStyle,
)
val Body
@Composable get() = TextStyle(
fontFamily = PretendardFamily,
fontSize = 16.sp,
fontWeight = FontWeight.Medium,
lineHeight = 24.sp,
platformStyle = platFormTextStyle,
color = JobisTheme.colors.onBackground,
)

val SubBody = TextStyle(
fontFamily = PretendardFamiliy,
fontSize = 14.sp,
fontWeight = FontWeight.SemiBold,
lineHeight = 20.sp,
platformStyle = platFormTextStyle,
)
val SubBody
@Composable get() = TextStyle(
fontFamily = PretendardFamily,
fontSize = 14.sp,
fontWeight = FontWeight.SemiBold,
lineHeight = 20.sp,
platformStyle = platFormTextStyle,
color = JobisTheme.colors.onBackground,
)

val Description = TextStyle(
fontFamily = PretendardFamiliy,
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
lineHeight = 20.sp,
platformStyle = platFormTextStyle,
)
val Description
@Composable get() = TextStyle(
fontFamily = PretendardFamily,
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
lineHeight = 20.sp,
platformStyle = platFormTextStyle,
color = JobisTheme.colors.onBackground,
)

val Caption = TextStyle(
fontFamily = PretendardFamiliy,
fontSize = 12.sp,
fontWeight = FontWeight.Medium,
lineHeight = 16.sp,
platformStyle = platFormTextStyle,
)
val Caption
@Composable get() = TextStyle(
fontFamily = PretendardFamily,
fontSize = 12.sp,
fontWeight = FontWeight.Medium,
lineHeight = 16.sp,
platformStyle = platFormTextStyle,
color = JobisTheme.colors.onBackground,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.text.style.TextOverflow
import team.returm.jobisdesignsystemv2.foundation.JobisTheme
Expand All @@ -28,6 +29,7 @@ fun JobisText(
style: TextStyle,
overflow: TextOverflow = TextOverflow.Ellipsis,
maxLines: Int = Int.MAX_VALUE,
textAlign: TextAlign? = null,
textDecoration: TextDecoration = TextDecoration.None,
) {
Text(
Expand All @@ -37,6 +39,7 @@ fun JobisText(
style = style,
overflow = overflow,
maxLines = maxLines,
textAlign = textAlign,
textDecoration = textDecoration,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
Expand Down Expand Up @@ -146,6 +147,7 @@ private fun TextField(
keyboardType = keyboardType,
imeAction = imeAction,
),
cursorBrush = SolidColor(JobisTheme.colors.onBackground),
) { innerTextField ->
Row(
modifier = Modifier.fillMaxWidth(),
Expand Down

0 comments on commit 6d8485d

Please sign in to comment.