Skip to content

Commit

Permalink
[FEAT/#64] 스크랩 취소 다이얼로그 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
arinming committed Jul 13, 2024
1 parent bb5c396 commit 4e17704
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 5 deletions.
3 changes: 3 additions & 0 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<string name="dialog_content_scrap_sub_title">공고를 캘린더에 스크랩하시겠어요?</string>
<string name="dialog_content_color_button">색상</string>
<string name="dialog_scrap_button">내 캘린더에 스크랩하기</string>
<string name="dialog_content_scrap_cancel_main_title">관심 공고가 캘린더에서 사라져요!</string>
<string name="dialog_content_scrap_cancel_sub_title">스크랩을 취소하시겠어요?</string>
<string name="dialog_scrap_cancel_button">스크랩 취소하기</string>

<!--Intern-->
<string name="intern_info_d_day">서류 마감</string>
Expand Down
10 changes: 7 additions & 3 deletions feature/src/main/java/com/terning/feature/intern/InternRoute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import com.terning.feature.intern.component.InternBottomBar
import com.terning.feature.intern.component.InternCompanyInfo
import com.terning.feature.intern.component.InternInfoRow
import com.terning.feature.intern.component.InternPageTitle
import com.terning.feature.intern.component.ScrapCancelDialogContent
import com.terning.feature.intern.component.ScrapDialogContent
import java.text.DecimalFormat

Expand Down Expand Up @@ -344,9 +345,12 @@ fun InternScreen(
viewModel.updateScrapDialogVisible(false)
},
content = {
// ScrapDialogContent(
// internInfoList = internInfoList
// )
when (state.isScrapped) {
true -> ScrapCancelDialogContent()
else -> ScrapDialogContent(
internInfoList = internInfoList
)
}
},
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package com.terning.feature.intern.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.terning.core.R
import com.terning.core.designsystem.component.button.RoundButton
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.Grey350
import com.terning.core.designsystem.theme.Grey500
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.feature.intern.InternViewModel


@Composable
fun ScrapCancelDialogContent(
viewModel: InternViewModel = hiltViewModel(),
) {
val state by viewModel.state.collectAsStateWithLifecycle()

Box(
modifier = Modifier
.fillMaxWidth()
.padding(top = 60.dp),
contentAlignment = Alignment.TopCenter
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 11.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Row(
modifier = Modifier
.size(60.dp)
.border(
width = 1.dp,
color = TerningMain,
shape = RoundedCornerShape(size = 15.dp)
)
) {
Image(
painter = painterResource(
id = R.drawable.ic_character1
),
modifier = Modifier
.fillMaxWidth()
.background(
Grey200,
shape = RoundedCornerShape(size = 15.dp)
),
contentDescription = null,
contentScale = ContentScale.Fit,
alignment = Alignment.Center
)
}
Text(
text = stringResource(id = R.string.dialog_content_scrap_cancel_main_title),
textAlign = TextAlign.Center,
style = TerningTheme.typography.title4,
color = Grey500,
modifier = Modifier.padding(top = 21.dp)
)
Text(
text = stringResource(id = R.string.dialog_content_scrap_cancel_sub_title),
style = TerningTheme.typography.body5,
color = Grey350,
modifier = Modifier.padding(
top = 5.dp,
bottom = 41.dp
)
)
RoundButton(
style = TerningTheme.typography.button3,
paddingVertical = 12.dp,
cornerRadius = 8.dp,
text = R.string.dialog_scrap_cancel_button,
onButtonClick = {
viewModel.updateScrapped(!state.isScrapped)
viewModel.updateScrapDialogVisible(false)
},
modifier = Modifier.padding(bottom = 8.dp)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import com.terning.feature.intern.InternViewModel

@Composable
fun ScrapDialogContent(
isScrapped: MutableState<Boolean> = mutableStateOf(false),
internInfoList: List<Pair<String, String>>,
viewModel: InternViewModel = hiltViewModel(),
) {
Expand Down Expand Up @@ -194,7 +193,7 @@ fun ScrapDialogContent(
style = TerningTheme.typography.button3,
paddingVertical = 12.dp,
cornerRadius = 8.dp,
text = if (isScrapped.value) {
text = if (state.isScrapped) {
if (state.isColorChange)
R.string.dialog_content_color_button
else R.string.dialog_scrap_button
Expand Down

0 comments on commit 4e17704

Please sign in to comment.