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

[FEAT] LGTMTheme 정의 및 적용 (#216) #217

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.lgtm.android.common_ui.R
import com.lgtm.android.common_ui.theme.LGTMTheme
import com.lgtm.android.common_ui.util.throttleClickable

@Composable
Expand All @@ -24,7 +24,7 @@ fun BackButton(
modifier = modifier
.border(
width = 1.dp,
color = colorResource(id = R.color.gray_3),
color = LGTMTheme.colors.gray_3,
shape = RoundedCornerShape(10.dp)
)
.background(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package com.lgtm.android.common_ui.components.buttons
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.lgtm.android.common_ui.R
import com.lgtm.android.common_ui.theme.body1M
import com.lgtm.android.common_ui.theme.LGTMTheme
import com.lgtm.android.common_ui.util.throttleClickable

@Composable
Expand All @@ -24,13 +24,14 @@ fun DialogConfirmationButton(
) {
Box(
modifier = modifier
.fillMaxWidth()
.background(
color = colorResource(id = confirmBtnBackground.background),
color = confirmBtnBackground.color,
shape = RoundedCornerShape(10.dp)
)
.border(
width = if (confirmBtnBackground == ConfirmButtonBackgroundColor.GREEN) 0.dp else 1.dp,
color = colorResource(id = R.color.gray_3),
color = LGTMTheme.colors.gray_3,
shape = RoundedCornerShape(10.dp)
)
.throttleClickable(
Expand All @@ -44,13 +45,20 @@ fun DialogConfirmationButton(
vertical = 11.dp
),
text = text,
style = Typography.body1M,
color = colorResource(id = R.color.black)
style = LGTMTheme.typography.body1M,
color = LGTMTheme.colors.black
)
}
}

enum class ConfirmButtonBackgroundColor(val background: Int) {
GREEN(R.color.green),
GRAY(R.color.gray_1)
enum class ConfirmButtonBackgroundColor {
GREEN,
GRAY;

val color: Color
@Composable
get() = when (this) {
GREEN -> LGTMTheme.colors.green
GRAY -> LGTMTheme.colors.gray_1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.lgtm.android.common_ui.R
import com.lgtm.android.common_ui.theme.body3R
import com.lgtm.android.common_ui.theme.LGTMTheme

@Composable
fun LikeButton(
Expand All @@ -33,11 +30,11 @@ fun LikeButton(
modifier = modifier
.border(
width = 1.dp,
color = colorResource(id = R.color.gray_2),
color = LGTMTheme.colors.gray_2,
shape = RoundedCornerShape(10.dp)
)
.background(
color = Color.White,
color = LGTMTheme.colors.white,
shape = RoundedCornerShape(10.dp)
)
.padding(
Expand All @@ -51,7 +48,7 @@ fun LikeButton(
.requiredWidth(30.dp),
text = likeNum,
textAlign = TextAlign.Center,
style = Typography.body3R
style = LGTMTheme.typography.body3R
)

Image(
Expand All @@ -65,7 +62,7 @@ fun LikeButton(
@Preview
@Composable
fun LikeButtonPreview() {
MaterialTheme {
LGTMTheme {
LikeButton(
likeNum = "22",
isLiked = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.lgtm.android.common_ui.R
import com.lgtm.android.common_ui.theme.LGTMTheme

@Composable
fun MenuButton(
Expand All @@ -24,11 +23,11 @@ fun MenuButton(
.wrapContentSize()
.border(
width = 1.dp,
color = colorResource(id = R.color.gray_3),
color = LGTMTheme.colors.gray_3,
shape = RoundedCornerShape(10.dp)
)
.background(
color = Color.White,
color = LGTMTheme.colors.white,
shape = RoundedCornerShape(10.dp)
)
.padding(3.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.lgtm.android.common_ui.R
import com.lgtm.android.common_ui.components.buttons.ConfirmButtonBackgroundColor
import com.lgtm.android.common_ui.components.buttons.DialogConfirmationButton
import com.lgtm.android.common_ui.theme.body1B
import com.lgtm.android.common_ui.theme.description
import com.lgtm.android.common_ui.theme.LGTMTheme

@Composable
fun LgtmConfirmationDialog(
Expand All @@ -32,7 +30,7 @@ fun LgtmConfirmationDialog(
Column(
modifier = Modifier
.fillMaxWidth()
.background(color = colorResource(id = R.color.white)),
.background(color = LGTMTheme.colors.white),
horizontalAlignment = Alignment.CenterHorizontally
) {
DialogDescription(dialogTitle, dialogDescription)
Expand All @@ -48,15 +46,15 @@ fun DialogDescription(
Text(
modifier = Modifier.padding(top = 30.dp),
text = title,
style = Typography.body1B,
color = colorResource(id = R.color.black)
style = LGTMTheme.typography.body1B,
color = LGTMTheme.colors.black
)
description?.let {
Text(
modifier = Modifier.padding(top = 10.dp),
text = description,
style = Typography.description,
color = colorResource(id = R.color.black)
style = LGTMTheme.typography.description,
color = LGTMTheme.colors.black
)
}
}
Expand Down Expand Up @@ -92,11 +90,13 @@ fun DialogButtons(
@Composable
@Preview
fun LGTMBottomSheetDialogContentPreview() {
LgtmConfirmationDialog(
dialogTitle = "작성을 중단할까요?",
dialogDescription = "작성한 내용은 저장되지 않아요.",
onClickCancel = {},
onClickConfirm = {},
confirmBtnBackground = ConfirmButtonBackgroundColor.GREEN
)
LGTMTheme {
LgtmConfirmationDialog(
dialogTitle = "작성을 중단할까요?",
dialogDescription = "작성한 내용은 저장되지 않아요.",
onClickCancel = {},
onClickConfirm = {},
confirmBtnBackground = ConfirmButtonBackgroundColor.GREEN
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material.Divider
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.lgtm.android.common_ui.R
import com.lgtm.android.common_ui.theme.description
import com.lgtm.android.common_ui.theme.LGTMTheme

@Composable
fun DateTimeText(
Expand All @@ -32,12 +29,12 @@ fun DateTimeText(
Text(
modifier = Modifier.padding(end = 3.dp),
text = date,
style = Typography.description,
color = colorResource(id = R.color.gray_5),
style = LGTMTheme.typography.description,
color = LGTMTheme.colors.gray_5,
)

Divider(
color = colorResource(id = R.color.gray_3),
color = LGTMTheme.colors.gray_3,
modifier = Modifier
.width(1.dp)
.fillMaxHeight()
Expand All @@ -49,16 +46,16 @@ fun DateTimeText(
Text(
modifier = Modifier.padding(start = 3.dp),
text = time,
style = Typography.description,
color = colorResource(id = R.color.gray_5)
style = LGTMTheme.typography.description,
color = LGTMTheme.colors.gray_5
)
}
}

@Preview
@Composable
fun DateTimePreview() {
MaterialTheme {
LGTMTheme {
DateTimeText(
date = "2021.09.01",
time = "오후 12:00"
Expand Down
Loading
Loading