Skip to content

Commit

Permalink
[FEAT/#53] TerningDialog 띄우기
Browse files Browse the repository at this point in the history
  • Loading branch information
arinming committed Jul 11, 2024
1 parent 3b3a723 commit e9a360f
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.terning.core.designsystem.component.dialog

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import com.terning.core.designsystem.theme.BackgroundColor

@Composable
fun TerningDialog(
onDismissRequest: () -> Unit,
properties: DialogProperties = DialogProperties(),
content: @Composable () -> Unit,
) {
Column(
modifier = Modifier.fillMaxSize().
background(BackgroundColor),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Dialog(
onDismissRequest = { onDismissRequest() },
properties = properties,
) {
content()
}
}
}

@Composable
fun DialogContent() {
Card(
modifier = Modifier
.fillMaxWidth()
.height(200.dp)
.padding(16.dp),
shape = RoundedCornerShape(20.dp),
) {
Text(
text = "This is a minimal dialog",
modifier = Modifier
.fillMaxSize()
.wrapContentSize(Alignment.Center),
textAlign = TextAlign.Center,
)
}
}

@Preview(showBackground = true)
@Composable
fun TerningDialogPreview() {
TerningDialog(onDismissRequest = {}, content = { DialogContent() })
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ val TerningSub5 = Color(0XFFF8FFFB)
// Background
val Back = Color(0xFFF8F8F8)
val ToastGrey = Color(0XFF666666)
val BackgroundColor = Color(0x4C000000)

// Calendar Color
val CalRed = Color(0xFFED4E54)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand All @@ -21,10 +23,11 @@ import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.navigation.NavHostController
import com.terning.core.designsystem.component.dialog.DialogContent
import com.terning.core.designsystem.component.dialog.TerningDialog
import com.terning.core.designsystem.theme.TerningPointTheme
import com.terning.core.extension.toast
import com.terning.feature.R
import com.terning.feature.home.home.navigation.navigateHome
import com.terning.feature.onboarding.signin.component.KakaoButton
import com.terning.feature.onboarding.signup.navigation.navigateSignUp

Expand Down Expand Up @@ -57,6 +60,8 @@ fun SignInScreen(
modifier: Modifier = Modifier,
onSignInClick: () -> Unit = {},
) {
val openDialog = remember { mutableStateOf(false) }

Column(
modifier = modifier
.wrapContentHeight()
Expand All @@ -72,11 +77,21 @@ fun SignInScreen(
KakaoButton(
title = stringResource(id = R.string.sign_in_kakao_button),
onSignInClick = {
onSignInClick()
// onSignInClick()
openDialog.value = true
},
modifier = modifier.padding(horizontal = 20.dp)
)
}

when {
openDialog.value -> {
TerningDialog(
onDismissRequest = { openDialog.value = false },
content = { DialogContent() }
)
}
}
}

@Preview(showBackground = true)
Expand Down

0 comments on commit e9a360f

Please sign in to comment.