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] Button 컴포넌트 구현 #25

Merged
merged 33 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a34d1fc
[feat] #9 DateRoadAddCourseButton
2hyunjinn Jul 6, 2024
1529347
[feat] #9 DateRoadAddScheduleButton
2hyunjinn Jul 6, 2024
046ba62
[feat] #9 DateRoadBasicButton
2hyunjinn Jul 6, 2024
aee81dd
[feat] #9 DateRoadBringButton
2hyunjinn Jul 6, 2024
29718c4
[feat] #9 DateRoadEditButton
2hyunjinn Jul 6, 2024
b24b3df
[feat] #9 DateRoadEditButton
2hyunjinn Jul 6, 2024
1dd1b3e
[feat] #9 DateRoadFloatingAddButton
2hyunjinn Jul 6, 2024
6d8956a
[feat] #9 DateRoadMorButton
2hyunjinn Jul 6, 2024
a06b9e4
[feat] #9 DateRoadMoreButton
2hyunjinn Jul 6, 2024
15ffa4c
[feat] #9 DateRoadNextButton
2hyunjinn Jul 6, 2024
eac3594
[feat] #9 DateRoadOnboardingNextButton
2hyunjinn Jul 6, 2024
e102455
[feat] #9 DateRoadOnboardingProfileButton
2hyunjinn Jul 6, 2024
eb1d910
[feat] #9 DateRoadPreviousDateButton
2hyunjinn Jul 6, 2024
29a8064
[feat] #9 DateRoadSameCheckButton
2hyunjinn Jul 6, 2024
5f16811
[feat] #9 카카오톡 로고 아이콘 추가
2hyunjinn Jul 6, 2024
e2f2900
[feat] #9 카카오톡 배경 색상 추가
2hyunjinn Jul 6, 2024
24eaf1d
[chore] #13 보류
2hyunjinn Jul 7, 2024
d966944
[del] #9 불필요한 파일 삭제
2hyunjinn Jul 7, 2024
77ae6ac
[feat] #9 DateRoadBackgroundButton
2hyunjinn Jul 7, 2024
d9889b6
[feat] #9 DateRoadButton
2hyunjinn Jul 7, 2024
f02f26f
[feat] #9 DateRoadEmptyButton
2hyunjinn Jul 7, 2024
78e6f6e
[feat] #9 DateRoadImageButton
2hyunjinn Jul 7, 2024
656a1c9
[chore] #9 DateRoadBasicButton
2hyunjinn Jul 7, 2024
c9d20d4
[del] #9 불필요한 파일 삭제
2hyunjinn Jul 7, 2024
2885ff1
[chore] #9 Alignment 속성 제거
2hyunjinn Jul 7, 2024
0de674e
[feat] #9 DateRoadFilledButton
2hyunjinn Jul 7, 2024
f6b0e3f
[feat] #9 DateRoadOutlinedButton
2hyunjinn Jul 7, 2024
796c3d5
[chore] #9 함수명 변경
2hyunjinn Jul 7, 2024
a5ff898
[chore] #9 DateRoadKakaoLoginButton 수정
2hyunjinn Jul 7, 2024
9efd08e
[chore] #9 ktlintformat
2hyunjinn Jul 7, 2024
8e66b77
[chore] #9 kakao 주석 추가
2hyunjinn Jul 7, 2024
7128edf
[chore] #9 코드 리뷰 수정
2hyunjinn Jul 7, 2024
f34c2fd
[chore] #9 ktlintFormat
2hyunjinn Jul 7, 2024
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
@@ -0,0 +1,50 @@
package org.sopt.dateroad.presentation.ui.component.button

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.sopt.dateroad.ui.theme.DATEROADTheme
import org.sopt.dateroad.ui.theme.DateRoadTheme

@Composable
fun DateRoadBasicButton(
modifier: Modifier = Modifier,
isEnabled: Boolean = true,
textContent: String,
onClick: () -> Unit = {}
) {
DateRoadFilledButton(
modifier = modifier.fillMaxWidth(),
isEnabled = isEnabled,
textContent = textContent,
textStyle = DateRoadTheme.typography.bodyBold15,
enabledBackgroundColor = DateRoadTheme.colors.deepPurple,
enabledTextColor = DateRoadTheme.colors.white,
disabledBackgroundColor = DateRoadTheme.colors.gray200,
disabledTextColor = DateRoadTheme.colors.gray400,
cornerRadius = 14.dp,
paddingHorizontal = 0.dp,
paddingVertical = 16.dp,
onClick = onClick
)
}

@Preview
@Composable
fun DateRoadBasicButtonPreview() {
DATEROADTheme {
Column {
DateRoadBasicButton(
isEnabled = true,
textContent = "프로필 등록하기"
)
DateRoadBasicButton(
isEnabled = false,
textContent = "프로필 등록하기"
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.sopt.dateroad.presentation.ui.component.button

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

@Composable
fun DateRoadButton(
modifier: Modifier = Modifier,
backgroundColor: Color,
borderColor: Color = Color.Unspecified,
borderWidth: Dp = 0.dp,
cornerRadius: Dp = 0.dp,
paddingHorizontal: Dp = 0.dp,
paddingVertical: Dp = 0.dp,
onClick: () -> Unit,
content: @Composable () -> Unit
) {
Box(
modifier = modifier
.clip(RoundedCornerShape(cornerRadius))
.background(color = backgroundColor)
.clickable(onClick = onClick)
.border(width = borderWidth, color = borderColor, shape = RoundedCornerShape(cornerRadius))
.padding(horizontal = paddingHorizontal, vertical = paddingVertical)
) {
content()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package org.sopt.dateroad.presentation.ui.component.button

import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Text
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.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import org.sopt.dateroad.ui.theme.DATEROADTheme
import org.sopt.dateroad.ui.theme.DateRoadTheme

@Composable
fun DateRoadFilledButton(
modifier: Modifier = Modifier,
isEnabled: Boolean = false,
textContent: String,
textStyle: TextStyle,
enabledBackgroundColor: Color,
enabledTextColor: Color,
disabledBackgroundColor: Color,
disabledTextColor: Color,
cornerRadius: Dp,
paddingHorizontal: Dp,
paddingVertical: Dp,
onClick: () -> Unit
) {
val backgroundColor = if (isEnabled) enabledBackgroundColor else disabledBackgroundColor
val textColor = if (isEnabled) enabledTextColor else disabledTextColor

2hyunjinn marked this conversation as resolved.
Show resolved Hide resolved
DateRoadButton(
modifier = modifier,
backgroundColor = backgroundColor,
cornerRadius = cornerRadius,
paddingHorizontal = paddingHorizontal,
paddingVertical = paddingVertical,
onClick = onClick
) {
Text(
text = textContent,
style = textStyle,
color = textColor
)
}
}

@Preview
@Composable
fun DateRoadFilledButtonPreview() {
DATEROADTheme {
Column {
DateRoadFilledButton(
isEnabled = true,
textContent = "중복확인",
onClick = {},
textStyle = DateRoadTheme.typography.bodyMed13,
enabledBackgroundColor = DateRoadTheme.colors.deepPurple,
enabledTextColor = DateRoadTheme.colors.white,
disabledBackgroundColor = DateRoadTheme.colors.gray200,
disabledTextColor = DateRoadTheme.colors.gray400,
cornerRadius = 10.dp,
paddingHorizontal = 14.dp,
paddingVertical = 6.dp
)
DateRoadFilledButton(
isEnabled = false,
textContent = "중복확인",
onClick = {},
textStyle = DateRoadTheme.typography.bodyMed13,
enabledBackgroundColor = DateRoadTheme.colors.deepPurple,
enabledTextColor = DateRoadTheme.colors.white,
disabledBackgroundColor = DateRoadTheme.colors.gray200,
disabledTextColor = DateRoadTheme.colors.gray400,
cornerRadius = 10.dp,
paddingHorizontal = 14.dp,
paddingVertical = 6.dp
)
DateRoadFilledButton(
isEnabled = true,
textContent = "불러오기",
onClick = {},
textStyle = DateRoadTheme.typography.bodyMed13,
enabledBackgroundColor = DateRoadTheme.colors.deepPurple,
enabledTextColor = DateRoadTheme.colors.white,
disabledBackgroundColor = DateRoadTheme.colors.gray200,
disabledTextColor = DateRoadTheme.colors.gray400,
cornerRadius = 20.dp,
paddingHorizontal = 10.dp,
paddingVertical = 5.dp
)
DateRoadFilledButton(
isEnabled = true,
textContent = "데이트 코스 받고 50P 받기",
onClick = {},
textStyle = DateRoadTheme.typography.bodyMed13,
enabledBackgroundColor = DateRoadTheme.colors.deepPurple,
enabledTextColor = DateRoadTheme.colors.white,
disabledBackgroundColor = DateRoadTheme.colors.gray200,
disabledTextColor = DateRoadTheme.colors.gray400,
cornerRadius = 10.dp,
paddingHorizontal = 20.dp,
paddingVertical = 10.dp
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package org.sopt.dateroad.presentation.ui.component.button

import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import org.sopt.dateroad.R
import org.sopt.dateroad.ui.theme.DATEROADTheme
import org.sopt.dateroad.ui.theme.DateRoadTheme

@Composable
fun DateRoadImageButton(
modifier: Modifier = Modifier,
isEnabled: Boolean = false,
enabledBackgroundColor: Color = DateRoadTheme.colors.deepPurple,
enabledContentColor: Color = DateRoadTheme.colors.white,
disabledBackgroundColor: Color = DateRoadTheme.colors.gray200,
disabledContentColor: Color = DateRoadTheme.colors.gray400,
iconResId: Int = R.drawable.ic_all_plus_white,
cornerRadius: Dp,
paddingHorizontal: Dp,
paddingVertical: Dp,
onClick: () -> Unit
) {
val backgroundColor = if (isEnabled) enabledBackgroundColor else disabledBackgroundColor
val contentColor = if (isEnabled) enabledContentColor else disabledContentColor

DateRoadButton(
modifier = modifier,
backgroundColor = backgroundColor,
cornerRadius = cornerRadius,
paddingHorizontal = paddingHorizontal,
paddingVertical = paddingVertical,
onClick = onClick
) {
Icon(
painter = painterResource(id = iconResId),
contentDescription = null,
tint = contentColor
)
}
}

@Preview
@Composable
fun DateRoadImageButtonPreview() {
DATEROADTheme {
Column {
DateRoadImageButton(
isEnabled = true,
onClick = {},
cornerRadius = 14.dp,
paddingHorizontal = 16.dp,
paddingVertical = 8.dp
)
DateRoadImageButton(
isEnabled = true,
onClick = {},
cornerRadius = 14.dp,
paddingHorizontal = 12.dp,
paddingVertical = 12.dp
)
DateRoadImageButton(
isEnabled = false,
onClick = {},
cornerRadius = 14.dp,
paddingHorizontal = 12.dp,
paddingVertical = 12.dp
)
DateRoadImageButton(
isEnabled = true,
onClick = {},
cornerRadius = 44.dp,
paddingHorizontal = 12.dp,
paddingVertical = 12.dp
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package org.sopt.dateroad.presentation.ui.component.button

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.sopt.dateroad.R
import org.sopt.dateroad.ui.theme.DATEROADTheme
import org.sopt.dateroad.ui.theme.DateRoadTheme

@Composable
fun DateRoadKakaoLoginButton(
modifier: Modifier = Modifier,
backgroundColor: Color = DateRoadTheme.colors.kakao,
contentColor: Color = DateRoadTheme.colors.black,
onClick: () -> Unit = {}
) {
DateRoadButton(
modifier = modifier.fillMaxWidth(),
backgroundColor = backgroundColor,
cornerRadius = 6.dp,
paddingVertical = 11.dp,
paddingHorizontal = 14.dp,
onClick = onClick
) {
Row(
verticalAlignment = Alignment.CenterVertically
) {
Image(
painter = painterResource(id = R.drawable.ic_kakao_logo),
contentDescription = null,
modifier = Modifier
.clip(CircleShape)
)
Spacer(modifier = Modifier.size(5.dp))
2hyunjinn marked this conversation as resolved.
Show resolved Hide resolved
Text(
text = "카카오 로그인",
2hyunjinn marked this conversation as resolved.
Show resolved Hide resolved
style = DateRoadTheme.typography.bodyBold13,
color = contentColor,
textAlign = TextAlign.Center,
modifier = Modifier
.align(Alignment.CenterVertically)
.fillMaxWidth()
)
}
}
}

@Preview
@Composable
fun DateRoadKakaoLoginButtonPreview() {
DATEROADTheme {
DateRoadKakaoLoginButton()
}
}
Loading
Loading