Skip to content

Commit

Permalink
fix: 공통 component button ui 수정 (#60) (KAN-136)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwahk committed Nov 6, 2024
1 parent dc609ab commit e64069a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/src/main/java/com/example/mhnfe/StartScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.example.mhnfe.ui.components.middleButton
import com.example.mhnfe.ui.components.MiddleButton

@Composable
fun StartScreen(
Expand Down Expand Up @@ -46,14 +46,14 @@ fun StartScreen(
horizontalAlignment = Alignment.CenterHorizontally
) {
// 로그인 버튼
middleButton(
MiddleButton(
text = "로그인",
onClick = onLoginClick,
modifier = Modifier.fillMaxWidth()
)

// Cam 회원 버튼
middleButton(
MiddleButton(
text = "회원가입",
onClick = onSignUpClick,
modifier = Modifier.fillMaxWidth()
Expand Down
29 changes: 21 additions & 8 deletions app/src/main/java/com/example/mhnfe/ui/components/button.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog
Expand All @@ -30,9 +35,9 @@ fun SmallButton(
) {
Button(
modifier = modifier
.wrapContentSize(),
.defaultMinSize(130.dp, 56.dp),
shape = RoundedCornerShape(16.dp),
contentPadding = PaddingValues(vertical = 18.dp, horizontal = 40.dp),
contentPadding = PaddingValues(vertical = 18.dp),
colors = ButtonDefaults.buttonColors(
containerColor = Color.White
),
Expand All @@ -47,16 +52,17 @@ fun SmallButton(
}

@Composable
fun middleButton(
fun MiddleButton(
modifier: Modifier = Modifier,
text: String,
onClick: () -> Unit
) {
Button(
modifier = modifier
.wrapContentSize(),
.wrapContentHeight()
.fillMaxWidth(),
shape = RoundedCornerShape(16.dp),
contentPadding = PaddingValues(vertical = 15.dp, horizontal = 140.dp),
contentPadding = PaddingValues(vertical = 15.dp),
colors = ButtonDefaults.buttonColors(
containerColor = mainYellow
),
Expand All @@ -74,14 +80,21 @@ fun middleButton(
fun NewQuizPreview(){
Column (
modifier = Modifier
.fillMaxSize(),
.fillMaxSize()
.padding(horizontal = 34.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(20.dp, alignment = Alignment.CenterVertically)
){
Row(
modifier = Modifier
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
SmallButton(text = "CCTV 추가") { }
middleButton(text = "회원가입") { }
SmallButton(text = "참여자 추가") { }
}
MiddleButton(text = "회원가입") { }
}

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.material3.Scaffold

import com.example.mhnfe.ui.components.MainTextBox
import com.example.mhnfe.ui.components.SubTopBar
import com.example.mhnfe.ui.components.middleButton
import com.example.mhnfe.ui.components.MiddleButton
import com.example.mhnfe.ui.theme.mainGray
import com.example.mhnfe.ui.theme.mainYellow

Expand Down Expand Up @@ -78,7 +78,7 @@ fun LoginScreen(
Spacer(modifier = Modifier.weight(1f))

// 로그인 버튼
middleButton(
MiddleButton(
text = "로그인",
onClick = onLoginClick,
modifier = Modifier.align(Alignment.CenterHorizontally)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.example.mhnfe.ui.components.MainTextBox
import com.example.mhnfe.ui.components.SubTopBar
import com.example.mhnfe.ui.components.middleButton
import com.example.mhnfe.ui.components.MiddleButton
import com.example.mhnfe.ui.theme.mainGray
import androidx.compose.ui.Alignment // Import 추가
import androidx.compose.foundation.Image
Expand Down Expand Up @@ -130,7 +130,7 @@ fun SignUpScreen(
Spacer(modifier = Modifier.weight(1f))

// 하단 버튼과 텍스트
middleButton(
MiddleButton(
text = if (currentStep == 3) "완료" else "다음",
onClick = {
if (currentStep < 3) {
Expand Down

0 comments on commit e64069a

Please sign in to comment.