Skip to content

Commit

Permalink
[feature/review_star_view]: add Review Dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
kez-lab committed Sep 29, 2023
1 parent 8ac13a4 commit 28fc905
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.everymeal.presentation.components

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
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.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.everymeal.presentation.ui.theme.Gray200
import com.everymeal.presentation.ui.theme.Grey7
import com.everymeal.presentation.ui.theme.Main100

@Composable
fun EveryMealGreyButton(
modifier: Modifier = Modifier,
buttonText: String,
onClick: () -> Unit = {}
) {
Button(
modifier = modifier,
colors = ButtonDefaults.buttonColors(
containerColor = Gray200,
contentColor = Grey7,
disabledContainerColor = Gray200,
disabledContentColor = Color.White,
),
onClick = onClick,
shape = RoundedCornerShape(12.dp),
contentPadding = PaddingValues(16.dp),
content = {
Text(
text = buttonText,
style = TextStyle(
fontSize = 16.sp,
fontWeight = FontWeight(500),
color = Grey7,
)
)
}
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.everymeal.presentation.components

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
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.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.everymeal.presentation.ui.theme.Gray200
import com.everymeal.presentation.ui.theme.Main100

@Composable
fun EveryMealRedButton(
modifier: Modifier = Modifier,
buttonText: String,
enabled: Boolean = true,
onClick: () -> Unit = {}
) {
Button(
modifier = modifier,
colors = ButtonDefaults.buttonColors(
containerColor = Main100,
contentColor = Color.White,
disabledContainerColor = Gray200,
disabledContentColor = Color.White,
),
enabled = enabled,
onClick = onClick,
shape = RoundedCornerShape(12.dp),
contentPadding = PaddingValues(16.dp),
content = {
Text(
text = buttonText,
style = TextStyle(
fontSize = 16.sp,
fontWeight = FontWeight(500),
color = Color.White,
)
)
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ 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 @@ -18,6 +21,7 @@ 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
Expand All @@ -35,13 +39,19 @@ 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.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 All @@ -50,7 +60,7 @@ fun ReviewScreen(
viewModel: ReviewScreenViewModel = hiltViewModel()
) {
val pickMultipleMedia = rememberLauncherForActivityResult(
ActivityResultContracts.PickMultipleVisualMedia(5)
ActivityResultContracts.PickMultipleVisualMedia(10)
) {
viewModel.setEvent(ReviewEvent.OnImageSelected(it))
Log.d("ReviewScreen", "ReviewScreen: $it")
Expand Down Expand Up @@ -153,7 +163,7 @@ fun ColumnScope.RestaurantType(
}

@Composable
fun ColumnScope.RestaurantName(
fun RestaurantName(
modifier: Modifier = Modifier,
viewState: ReviewState
) {
Expand Down Expand Up @@ -254,8 +264,58 @@ fun ReviewTopBar() {
)
}

@Composable
fun ReviewSaveDialog(
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)
)
}
}
}
}
)
}

@Composable
@Preview
fun ReviewScreenPreview() {
ReviewScreen()
ReviewSaveDialog()
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)

val MONO_BLACK = Color(0xFF191F28)

val Gray100 = Color(0xFFF9FAFB)
val Gray200 = Color(0xFFE5E8EB)
val Gray300 = Color(0xFFF2F4F6)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ val EveryMealTypography = Typography(
titleLarge = TextStyle(
fontFamily = Pretendard,
fontWeight = FontWeight.Bold,
fontSize = 24.sp,
fontSize = 18.sp,
),
titleMedium = TextStyle(
fontFamily = Pretendard,
fontWeight = FontWeight.Bold,
fontSize = 20.sp,
fontSize = 16.sp,
),
titleSmall = TextStyle(
fontFamily = Pretendard,
fontWeight = FontWeight.Bold,
fontSize = 16.sp,
fontSize = 15.sp,
),
displayLarge = TextStyle(
fontFamily = Pretendard,
Expand Down Expand Up @@ -97,16 +97,16 @@ val EveryMealTypography = Typography(
bodyLarge = TextStyle(
fontFamily = Pretendard,
fontWeight = FontWeight.Normal,
fontSize = 24.sp,
fontSize = 16.sp,
),
bodyMedium = TextStyle(
fontFamily = Pretendard,
fontWeight = FontWeight.Normal,
fontSize = 20.sp,
fontSize = 15.sp,
),
bodySmall = TextStyle(
fontFamily = Pretendard,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
fontSize = 14.sp,
),
)
)
7 changes: 6 additions & 1 deletion presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

<!-- 공통 -->
<string name="select">선택하기</string>
<string name="register">등록하기</string>
<string name="register">등록하기</string>기
<string name="close">닫기</string>
<string name="exit">나가기</string>

<!-- 로그인, 온보딩, 대학선택화면 -->
<string name="univ_select_title">반가워요!\n대학을 선택해주세요</string>
Expand Down Expand Up @@ -69,6 +71,9 @@
<string name="univ_admin_review_title">학교 인증이 된 사용자만\n리뷰를 남길 수 있어요</string>
<string name="univ_admin_review_content">바이럴 마케팅 없는 신뢰적인 정보를 공유하기 위해\n학교 인증이 필요해요</string>
<string name="univ_admin_button">인증하러 가기</string>
<string name="review_save_dialog_title">다음에 리뷰를 남길까요?</string>
<string name="review_save_dialog_content">지금까지 작성한 내용은 저장되지 않아요.</string>
<string name="review_save_dialog_write_continue">계속쓰기</string>

<!-- 상세 리스트 바텀 시트 다이얼로그 -->
<string name="popularity_sort">인기순</string>
Expand Down

0 comments on commit 28fc905

Please sign in to comment.