Skip to content

Commit

Permalink
[feature/review_star_view]: add EveryMealDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
kez-lab committed Oct 2, 2023
1 parent 28fc905 commit b8bbe1d
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 54 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.everymeal.presentation.components

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import com.everymeal.presentation.ui.theme.EveryMealTypography
import com.everymeal.presentation.ui.theme.Grey7
import com.everymeal.presentation.ui.theme.MONO_BLACK

@Composable
fun EveryMealDialog(
modifier: Modifier = Modifier,
title: String,
message: String,
confirmButtonText: String,
dismissButtonText: String,
onDismissRequest: () -> Unit,
onConfirmClick: () -> Unit,
onDisMissClicked: () -> Unit
) {
Dialog(
onDismissRequest = onDismissRequest,
content = {
Surface(
modifier = modifier,
shape = RoundedCornerShape(10.dp),
) {
Column(
modifier = Modifier
.padding(top = 8.dp)
.padding(16.dp)
) {
Text(
text = title,
style = EveryMealTypography.titleLarge,
color = MONO_BLACK
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = message,
style = EveryMealTypography.bodyMedium,
color = Grey7
)
Spacer(modifier = Modifier.height(24.dp))
Row {
EveryMealGreyButton(
modifier = Modifier
.weight(1f)
.padding(end = 4.dp),
onClick = onDisMissClicked,
buttonText = dismissButtonText
)
EveryMealRedButton(
modifier = Modifier
.weight(1f)
.padding(start = 4.dp),
onClick = onConfirmClick,
buttonText = confirmButtonText
)
}
}
}
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyRow
Expand All @@ -21,13 +18,14 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.State
import androidx.compose.runtime.collectAsState
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.graphics.Color
Expand All @@ -39,19 +37,14 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Dialog
import androidx.hilt.navigation.compose.hiltViewModel
import com.everymeal.presentation.R
import com.everymeal.presentation.components.EveryMealGreyButton
import com.everymeal.presentation.components.EveryMealRedButton
import com.everymeal.presentation.components.EveryMealDialog
import com.everymeal.presentation.ui.review.write.ReviewWriteScreen
import com.everymeal.presentation.ui.search.topbar.SearchBar
import com.everymeal.presentation.ui.theme.EveryMealTypography
import com.everymeal.presentation.ui.theme.Gray600
import com.everymeal.presentation.ui.theme.Grey2
import com.everymeal.presentation.ui.theme.Grey7
import com.everymeal.presentation.ui.theme.Grey9
import com.everymeal.presentation.ui.theme.MONO_BLACK
import com.everymeal.presentation.ui.theme.Typography


Expand Down Expand Up @@ -266,52 +259,25 @@ fun ReviewTopBar() {

@Composable
fun ReviewSaveDialog(
modifier: Modifier = Modifier,
modifier: Modifier = Modifier
) {
Dialog(
onDismissRequest = { },
content = {
Surface (
modifier = modifier,
shape = RoundedCornerShape(10.dp),
){
Column(
modifier = Modifier
.padding(top = 8.dp)
.padding(16.dp)
) {
Text(
text = stringResource(R.string.review_save_dialog_title),
style = EveryMealTypography.titleLarge,
color = MONO_BLACK
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = stringResource(R.string.review_save_dialog_content),
style = EveryMealTypography.bodyMedium,
color = Grey7
)
Spacer(modifier = Modifier.height(24.dp))
Row {
EveryMealGreyButton(
modifier = Modifier
.weight(1f)
.padding(end = 4.dp),
onClick = { /*TODO*/ },
buttonText = stringResource(R.string.review_save_dialog_write_continue)
)
EveryMealRedButton(
modifier = Modifier
.weight(1f)
.padding(start = 4.dp),
onClick = { /*TODO*/ },
buttonText = stringResource(R.string.exit)
)
}
}
val showDialog = remember { mutableStateOf(true) }
if (showDialog.value) {
EveryMealDialog(
modifier = modifier,
title = stringResource(R.string.review_save_dialog_title),
message = stringResource(R.string.review_save_dialog_content),
confirmButtonText = stringResource(R.string.exit),
dismissButtonText = stringResource(R.string.review_save_dialog_write_continue),
onDismissRequest = {},
onConfirmClick = {
showDialog.value = false
},
onDisMissClicked = {
showDialog.value = false
}
}
)
)
}
}

@Composable
Expand Down

0 comments on commit b8bbe1d

Please sign in to comment.