Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#13 : 쪽지 전용 컴포넌트 구현 #24

Merged
merged 8 commits into from
Jul 10, 2024
Merged
4 changes: 4 additions & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,9 @@ gradlePlugin {
id = "com.bff.wespot.jvm.library"
implementationClass = "com.bff.wespot.plugin.JvmLibraryPlugin"
}
create("androidKtLint") {
id = "com.bff.wespot.ktlint"
implementationClass = "com.bff.wespot.plugin.AndroidKtLintPlugin"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.bff.wespot.plugin

import com.bff.wespot.plugin.configure.configureKtLint
import org.gradle.api.Plugin
import org.gradle.api.Project

class AndroidKtLintPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("org.jlleitschuh.gradle.ktlint")
}

configureKtLint()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ internal fun Project.configureKtLint() {
"ktlint_standard_no-wildcard-imports" to "disabled",
"ktlint_standard_filename" to "disabled",
"ktlint_standard_function-naming" to "disabled",
"ktlint_standard_function-signature" to "disabled",
"ktlint_standard_class-naming" to "disabled",
"ktlint_standard_string-template-indent" to "disabled",
"ktlint_standard_multiline-expression-wrapping" to "disabled"
)
)
reporters {
Expand Down
1 change: 1 addition & 0 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.wespot.android.library)
alias(libs.plugins.wespot.android.compose)
alias(libs.plugins.wespot.android.ktlint)
}

android {
Expand Down
1 change: 1 addition & 0 deletions designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.wespot.android.library)
alias(libs.plugins.wespot.android.compose)
alias(libs.plugins.wespot.android.ktlint)
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ import com.bff.wespot.designsystem.util.OrientationPreviews
fun WSBannerType(
title: String,
subTitle: String? = null,
bannerType: WSBannerType = WSBannerType.Primary
bannerType: WSBannerType = WSBannerType.Primary,
) {
WSBanner(
title = title,
subTitle = subTitle,
bannerType = bannerType
bannerType = bannerType,
)
}

Expand All @@ -53,13 +53,13 @@ fun WSBanner(
title: String,
icon: ImageVector,
subTitle: String? = null,
bannerType: WSBannerType = WSBannerType.Primary
bannerType: WSBannerType = WSBannerType.Primary,
) {
WSBanner(
icon = rememberVectorPainter(image = icon),
title = title,
subTitle = subTitle,
bannerType = bannerType
bannerType = bannerType,
)
}

Expand All @@ -68,36 +68,35 @@ fun WSBanner(
title: String,
icon: ImageBitmap,
subTitle: String? = null,
bannerType: WSBannerType = WSBannerType.Primary
bannerType: WSBannerType = WSBannerType.Primary,
) {
WSBanner(
icon = BitmapPainter(icon),
title = title,
subTitle = subTitle,
bannerType = bannerType
bannerType = bannerType,
)
}


@Composable
fun WSBanner(
title: String,
icon: Painter? = null,
subTitle: String? = null,
bannerType: WSBannerType = WSBannerType.Primary
bannerType: WSBannerType = WSBannerType.Primary,
) {
Box(
modifier = Modifier
.padding(16.dp)
.height(80.dp)
.fillMaxWidth()
.clip(WeSpotThemeManager.shapes.medium)
.background(bannerType.backgroundColor())
.background(bannerType.backgroundColor()),
) {
Row(
modifier = Modifier
.fillMaxSize(),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
) {
icon?.let {
Icon(
Expand All @@ -111,19 +110,19 @@ fun WSBanner(
Column(
modifier = Modifier
.padding(vertical = 18.dp)
.padding(start = if (icon != null) 0.dp else 20.dp)
.padding(start = if (icon != null) 0.dp else 20.dp),
) {
Text(
text = title,
color = bannerType.titleColor(),
style = bannerType.titleTextStyle()
style = bannerType.titleTextStyle(),
)

subTitle?.let { subTitle ->
Text(
text = subTitle,
color = bannerType.subTitleColor().copy(alpha = 0.8f),
style = bannerType.subTitleTextStyle()
style = bannerType.subTitleTextStyle(),
)
}
}
Expand All @@ -132,23 +131,21 @@ fun WSBanner(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight(),
contentAlignment = Alignment.CenterEnd
contentAlignment = Alignment.CenterEnd,
) {
Icon(
painter = painterResource(id = R.drawable.right_arrow),
contentDescription = stringResource(id = R.string.right_arrow),
tint = WeSpotThemeManager.colors.abledIconColor,
modifier = Modifier
.padding(end = 24.dp)
.padding(end = 24.dp),
)
}
}

}
}

sealed interface WSBannerType {

@Composable
fun backgroundColor(): Color

Expand Down Expand Up @@ -211,7 +208,7 @@ private fun WSBannerPreview() {
icon = Icons.AutoMirrored.Default.Send,
title = stringResource(id = R.string.message_arrived),
subTitle = stringResource(id = R.string.open_inbox_for_message),
bannerType = WSBannerType.Primary
bannerType = WSBannerType.Primary,
)

WSBanner(
Expand All @@ -222,15 +219,15 @@ private fun WSBannerPreview() {
WSBanner(
icon = Icons.AutoMirrored.Default.Accessible,
title = stringResource(id = R.string.message_arrived),
bannerType = WSBannerType.Secondary
bannerType = WSBannerType.Secondary,
)

WSBanner(
title = stringResource(id = R.string.message_arrived),
subTitle = stringResource(id = R.string.open_inbox_for_message),
bannerType = WSBannerType.Secondary
bannerType = WSBannerType.Secondary,
)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ fun WSButton(
modifier = Modifier.fillMaxWidth(),
onClick = onClick,
colors =
ButtonDefaults.buttonColors(
contentColor = buttonType.textColor(),
containerColor =
if (isPressed) {
buttonType.pressColor()
} else {
buttonType.background()
},
disabledContentColor = WeSpotThemeManager.colors.disableBtnTxtColor.copy(alpha = 0.8f),
disabledContainerColor = WeSpotThemeManager.colors.disableBtnColor,
),
ButtonDefaults.buttonColors(
contentColor = buttonType.textColor(),
containerColor =
if (isPressed) {
buttonType.pressColor()
} else {
buttonType.background()
},
disabledContentColor = WeSpotThemeManager.colors.disableBtnTxtColor.copy(alpha = 0.8f),
disabledContainerColor = WeSpotThemeManager.colors.disableBtnColor,
),
interactionSource = interactionSource,
shape = WeSpotThemeManager.shapes.small,
enabled = enabled,
Expand All @@ -79,7 +79,7 @@ fun WSButton(
} else {
borderStroke
},
contentPadding = PaddingValues(0.dp)
contentPadding = PaddingValues(0.dp),
) {
content {
Text(
Expand Down Expand Up @@ -160,21 +160,24 @@ private fun WSButtonPreview() {
WSButton(
text = stringResource(id = R.string.register_classmate),
buttonType = WSButtonType.Primary,
onClick = {}) {
onClick = {},
) {
it()
}

WSButton(
text = stringResource(id = R.string.register_classmate),
buttonType = WSButtonType.Secondary,
onClick = {}) {
onClick = {},
) {
it()
}

WSButton(
text = stringResource(id = R.string.register_classmate),
buttonType = WSButtonType.Tertiary,
onClick = {}) {
onClick = {},
) {
it()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import com.bff.wespot.designsystem.theme.WeSpotTheme
import com.bff.wespot.designsystem.theme.WeSpotThemeManager
import com.bff.wespot.designsystem.util.OrientationPreviews


@Composable
fun WSTextButton(
text: String,
Expand All @@ -31,8 +30,7 @@ fun WSTextButton(
buttonType: WSTextButtonType = WSTextButtonType.Primary,
) {
Box(
modifier =
Modifier
modifier = Modifier
.wrapContentSize()
.padding(8.dp),
) {
Expand Down Expand Up @@ -81,12 +79,12 @@ private fun WSTextButtonPreview() {
WSTextButton(
text = stringResource(id = R.string.any_friend_not_registered),
onClick = {},
buttonType = WSTextButtonType.Primary
buttonType = WSTextButtonType.Primary,
)
WSTextButton(
text = stringResource(id = R.string.any_friend_not_registered),
onClick = {},
buttonType = WSTextButtonType.Underline
buttonType = WSTextButtonType.Underline,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import com.bff.wespot.designsystem.theme.WeSpotTheme
import com.bff.wespot.designsystem.theme.WeSpotThemeManager
import com.bff.wespot.designsystem.util.OrientationPreviews


@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun WSTopBar(
Expand All @@ -37,24 +36,25 @@ fun WSTopBar(
canNavigateBack: Boolean = false,
navigateUp: () -> Unit = {},
action: @Composable RowScope.(textStyle: TextStyle) -> Unit = { },
scrollBehavior: TopAppBarScrollBehavior? = null
scrollBehavior: TopAppBarScrollBehavior? = null,
) {
CenterAlignedTopAppBar(
title = {
Text(
text = title,
style = StaticTypeScale.Default.header2,
color = WeSpotThemeManager.colors.txtTitleColor
color = WeSpotThemeManager.colors.txtTitleColor,
)
},
navigationIcon = {
if (canNavigateBack) {
IconButton(
modifier = Modifier.padding(start = 4.dp),
onClick = { navigateUp.invoke() }) {
onClick = { navigateUp.invoke() },
) {
Icon(
painter = painterResource(id = R.drawable.left_arrow),
contentDescription = stringResource(id = R.string.navigate_back)
contentDescription = stringResource(id = R.string.navigate_back),
)
}
} else {
Expand All @@ -69,8 +69,8 @@ fun WSTopBar(
colors = TopAppBarDefaults.topAppBarColors(
containerColor = WeSpotThemeManager.colors.backgroundColor,
navigationIconContentColor = Gray400,
actionIconContentColor = Gray400
)
actionIconContentColor = Gray400,
),
)
}

Expand All @@ -87,18 +87,18 @@ private fun WSTopBarPreview() {
IconButton(onClick = { }) {
Icon(
imageVector = Icons.Default.Search,
contentDescription = stringResource(id = R.string.search)
contentDescription = stringResource(id = R.string.search),
)
}
})
WSTopBar(title = "", canNavigateBack = true, action = {
Text(
text = stringResource(id = R.string.to_home),
style = it,
color = WeSpotThemeManager.colors.txtTitleColor
color = WeSpotThemeManager.colors.txtTitleColor,
)
})
}
}
}
}
}
Loading
Loading