diff --git a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt new file mode 100644 index 00000000..b82b27ed --- /dev/null +++ b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt @@ -0,0 +1,68 @@ +package com.everymeal.presentation.components + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ModalBottomSheet +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.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.everymeal.presentation.R +import com.everymeal.presentation.ui.theme.Gray600 +import com.everymeal.presentation.ui.theme.Gray900 + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun EveryMealMainBottomSheetDialog( + title: String, + content: String, + onClick : () -> Unit, + onDismiss: () -> Unit +) { + ModalBottomSheet( + onDismissRequest = { onDismiss() }, + containerColor = Color.White, + ) { + Column( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 20.dp) + ) { + Image( + painter = painterResource(id = R.drawable.icon_school), + contentDescription = stringResource(R.string.icon_univ), + modifier = Modifier.size(64.dp) + ) + Spacer(modifier = Modifier.padding(10.dp)) + Text( + text = title, + fontSize = 22.sp, + color = Gray900, + fontWeight = FontWeight.Bold, + ) + Spacer(modifier = Modifier.padding(4.dp)) + Text( + text = content, + fontSize = 15.sp, + color = Gray600, + fontWeight = FontWeight.Medium, + ) + Spacer(modifier = Modifier.padding(10.dp)) + EveryMealMainButton( + text = stringResource(R.string.univ_admin_button), + onClick = onClick, + ) + Spacer(modifier = Modifier.padding(10.dp)) + } + } +} \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt index cbf84989..703c3c4c 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt @@ -8,10 +8,13 @@ import com.everymeal.presentation.base.ViewState class HomeContract { data class HomeState( val uiState: LoadState = LoadState.SUCCESS, + val bottomSheetState: Boolean = false ) : ViewState sealed class HomeEvent : ViewEvent { - + data class BottomSheetStateChange( + val bottomSheetState: Boolean + ) : HomeEvent() } sealed class HomeEffect : ViewSideEffect { diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt index 9b4c3bbc..72d76249 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt @@ -3,6 +3,7 @@ package com.everymeal.presentation.ui.home import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -23,6 +24,11 @@ import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -33,8 +39,10 @@ import androidx.compose.ui.text.font.FontWeight.Companion.Bold import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import androidx.hilt.navigation.compose.hiltViewModel import com.everymeal.presentation.R import com.everymeal.presentation.components.EveryMealLineButton +import com.everymeal.presentation.components.EveryMealMainBottomSheetDialog import com.everymeal.presentation.components.EveryMealRestaurantItem import com.everymeal.presentation.components.EveryMealReviewItem import com.everymeal.presentation.ui.theme.EveryMeal_AndroidTheme @@ -46,7 +54,7 @@ import com.everymeal.presentation.ui.theme.Paddings @Composable fun HomeScreen( - + homeViewModel : HomeViewModel = hiltViewModel(), ) { val items = listOf( Restaurant( @@ -74,6 +82,21 @@ fun HomeScreen( ), ) + val homeViewState by homeViewModel.viewState.collectAsState() + + if (homeViewState.bottomSheetState) { + EveryMealMainBottomSheetDialog( + title = stringResource(id = R.string.univ_admin_review_title), + content = stringResource(id = R.string.univ_admin_review_content), + onClick = { + + }, + onDismiss = { + homeViewModel.setEvent(HomeContract.HomeEvent.BottomSheetStateChange(false)) + } + ) + } + val reviewTestItem = listOf( Review( name = "슈니", @@ -114,7 +137,9 @@ fun HomeScreen( .fillMaxWidth(), ) { item { - HomeMainTopLayout() + HomeMainTopLayout { + homeViewModel.setEvent(HomeContract.HomeEvent.BottomSheetStateChange(true)) + } HomeCategoryList() Spacer(modifier = Modifier.padding(10.dp)) @@ -223,12 +248,20 @@ fun HomeTopAppBar() { } @Composable -fun HomeMainTopLayout() { +fun HomeMainTopLayout( + onClick: () -> Unit, +) { Row( modifier = Modifier .fillMaxWidth() .padding(20.dp) .background(Gray300, RoundedCornerShape(12.dp)) + .clickable( + indication = null, + interactionSource = remember { MutableInteractionSource() } + ) { + onClick() + } .padding(horizontal = Paddings.extra, vertical = 14.dp), verticalAlignment = Alignment.CenterVertically, ) { diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeViewModel.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeViewModel.kt index 6027938d..078fde02 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeViewModel.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeViewModel.kt @@ -35,6 +35,14 @@ class HomeViewModel @Inject constructor( ) { override fun handleEvents(event: HomeEvent) { - + when (event) { + is HomeEvent.BottomSheetStateChange -> { + updateState { + copy( + bottomSheetState = event.bottomSheetState + ) + } + } + } } } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/theme/Color.kt b/presentation/src/main/java/com/everymeal/presentation/ui/theme/Color.kt index eeb9e663..aff0f3ce 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/theme/Color.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/theme/Color.kt @@ -17,6 +17,7 @@ val Gray500 = Color(0xFFB0B8C1) val Gray600 = Color(0xFF8B95A1) val Gray700 = Color(0xFF6B7684) var Gray800 = Color(0xFF4E5968) +val Gray900 = Color(0xFF333D4B) val Grey2 = Color(0xFFF2F4F6) val Grey7 = Color(0xFF6B7684) diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 6ce12c1f..86f6f574 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -58,4 +58,9 @@ 저장 저장한 가게가 없어요 + + 학교 인증이 된 사용자만\n리뷰를 남길 수 있어요 + 바이럴 마케팅 없는 신뢰적인 정보를 공유하기 위해\n학교 인증이 필요해요 + 인증하러 가기 + \ No newline at end of file