Skip to content

Commit

Permalink
[MERGE] #244 -> develop
Browse files Browse the repository at this point in the history
[MOD/#244] ๋‹ค์ด์–ผ๋กœ๊ทธ ๋ฒ„ํŠผ ์ˆ˜์ •
  • Loading branch information
boiledEgg-s authored Sep 13, 2024
2 parents 5f590c8 + 728ffcb commit 20dfc25
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import com.terning.core.type.ColorType
import com.terning.feature.R
import com.terning.feature.dialog.detail.component.ColorPalette
import com.terning.feature.dialog.detail.component.ScrapColorChangeButton
import com.terning.feature.intern.component.InternInfoRow
import com.terning.feature.dialog.detail.component.ScrapInfoRow


@Composable
Expand Down Expand Up @@ -86,7 +86,11 @@ fun ScrapDialog(
onDismissRequest()
}

is ScrapDialogSideEffect.PatchedScrap -> onClickChangeColor()
is ScrapDialogSideEffect.PatchedScrap -> {
onClickChangeColor()
onDismissRequest()
}

is ScrapDialogSideEffect.NavigateToDetail -> onClickNavigateButton(
internshipAnnouncementId
)
Expand Down Expand Up @@ -116,7 +120,6 @@ fun ScrapDialog(
companyImage = companyImage,
selectedColorType = uiState.selectedColorType,
isColorChanged = uiState.isColorChanged,
isColorChangedOnce = uiState.isColorChangedOnce,
onClickColorButton = viewModel::changeSelectedColor,
onClickColorChangeButton = {
if (uiState.isColorChanged)
Expand Down Expand Up @@ -144,7 +147,6 @@ private fun ScrapDialogScreen(
companyImage: String,
selectedColorType: ColorType,
isColorChanged: Boolean,
isColorChangedOnce: Boolean,
onClickColorButton: (ColorType) -> Unit,
onClickNavigateButton: () -> Unit,
onClickColorChangeButton: () -> Unit,
Expand All @@ -158,7 +160,7 @@ private fun ScrapDialogScreen(
) {
Column(
modifier = Modifier
.padding(horizontal = 11.dp),
.padding(horizontal = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
AsyncImage(
Expand Down Expand Up @@ -221,54 +223,49 @@ private fun ScrapDialogScreen(

Spacer(modifier = Modifier.height(8.dp))

Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.Center
) {
ColorPalette(
selectedColor = selectedColorType,
onColorSelected = onClickColorButton
)
}
HorizontalDivider(
thickness = 1.dp,
color = Grey200,
modifier = Modifier.padding(vertical = 8.dp)
ColorPalette(
selectedColor = selectedColorType,
onColorSelected = onClickColorButton
)
}

HorizontalDivider(
thickness = 1.dp,
color = Grey200,
modifier = Modifier.padding(vertical = 8.dp)
)

Column(
modifier = Modifier.padding(vertical = 4.dp),
verticalArrangement = Arrangement.spacedBy(
5.dp,
Alignment.CenterVertically
),
horizontalAlignment = Alignment.Start,
) {
InternInfoRow(
title = stringResource(id = R.string.intern_info_d_day),
value = deadline
)
InternInfoRow(
title = stringResource(id = R.string.intern_info_working),
value = workingPeriod
)
InternInfoRow(
title = stringResource(id = R.string.intern_info_start_date),
value = startYearMonth
)
}
Column(
modifier = Modifier
.padding(vertical = 4.dp, horizontal = 13.dp)
.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(
5.dp,
Alignment.CenterVertically
),
horizontalAlignment = Alignment.Start,
) {
ScrapInfoRow(
title = stringResource(id = R.string.intern_info_d_day),
value = deadline
)
ScrapInfoRow(
title = stringResource(id = R.string.intern_info_working),
value = workingPeriod
)
ScrapInfoRow(
title = stringResource(id = R.string.intern_info_start_date),
value = startYearMonth
)
}

Spacer(modifier = Modifier.height(8.dp))

if (isScrapped) {
DetailScrapButton(
isColorChanged = isColorChanged,
isColorChangedOnce = isColorChangedOnce,
onClickNavigateButton = onClickNavigateButton,
onClickColorChangeButton = onClickColorChangeButton

)
} else {
NewScrapButton(onClickScrapButton = onClickScrapButton)
Expand All @@ -295,7 +292,6 @@ private fun NewScrapButton(
@Composable
private fun DetailScrapButton(
isColorChanged: Boolean,
isColorChangedOnce: Boolean,
onClickNavigateButton: () -> Unit,
onClickColorChangeButton: () -> Unit,
modifier: Modifier = Modifier
Expand All @@ -305,7 +301,6 @@ private fun DetailScrapButton(
) {
ScrapColorChangeButton(
isColorChanged = isColorChanged,
isColorChangedOnce = isColorChangedOnce,
paddingVertical = 12.dp,
cornerRadius = 8.dp,
onButtonClick = onClickColorChangeButton,
Expand Down Expand Up @@ -339,7 +334,6 @@ private fun ScrapDialogPreview() {
onClickScrapButton = {},
onClickColorButton = {},
isColorChanged = false,
isColorChangedOnce = true,
selectedColorType = ColorType.RED
)
}
Expand All @@ -363,7 +357,6 @@ private fun DetailScrapButtonPreview() {
onClickNavigateButton = {},
onClickColorChangeButton = {},
isColorChanged = false,
isColorChangedOnce = false
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class ScrapDialogViewModel @Inject constructor(
_uiState.update { currentState ->
currentState.copy(
isColorChanged = false,
isColorChangedOnce = false
)
}
}
Expand All @@ -48,7 +47,7 @@ class ScrapDialogViewModel @Inject constructor(
_uiState.update { currentState ->
currentState.copy(
selectedColorType = colorType,
isColorChanged = colorType != _uiState.value.initialColorType
isColorChanged = true
)
}
}
Expand Down Expand Up @@ -86,7 +85,6 @@ class ScrapDialogViewModel @Inject constructor(
currentState.copy(
initialColorType = color,
isColorChanged = false,
isColorChangedOnce = true,
)
}
}.onFailure {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fun ColorPalette(
onColorSelected = onOptionSelected
)
},
verticalArrangementSpace = 6.dp,
verticalArrangementSpace = 0.dp,
horizontalArrangementSpace = 0.dp,
modifier = modifier.wrapContentSize()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.Grey375
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningSub4
import com.terning.core.designsystem.theme.TerningSub5
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
Expand All @@ -33,7 +33,6 @@ import com.terning.feature.R
@Composable
fun ScrapColorChangeButton(
isColorChanged: Boolean,
isColorChangedOnce: Boolean,
cornerRadius: Dp,
paddingVertical: Dp,
onButtonClick: () -> Unit,
Expand All @@ -43,22 +42,17 @@ fun ScrapColorChangeButton(
val isPressed by interactionSource.collectIsPressedAsState()

val backgroundColor = when {
isColorChangedOnce && !isColorChanged -> TerningSub4
isColorChanged && !isPressed -> White
isColorChanged && isPressed -> TerningSub5
else -> White
}
val textColor = when {
!isColorChangedOnce && !isColorChanged -> Grey400
else -> TerningMain
isColorChanged -> TerningMain
else -> Grey375
}
val borderColor = when {
!isColorChangedOnce && !isColorChanged -> Grey150
else -> TerningMain
}
val text = when {
isColorChangedOnce && !isColorChanged -> R.string.dialog_content_calendar_color_change_complete
else -> R.string.dialog_content_calendar_color_change
isColorChanged -> TerningMain
else -> Grey150
}

CompositionLocalProvider(LocalRippleTheme provides NoRippleTheme) {
Expand All @@ -80,7 +74,7 @@ fun ScrapColorChangeButton(
onClick = onButtonClick
) {
Text(
text = stringResource(id = text),
text = stringResource(id = R.string.dialog_content_calendar_color_change),
style = TerningTheme.typography.button3,
textAlign = TextAlign.Center,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.terning.feature.dialog.detail.component

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey375
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningTheme

@Composable
fun ScrapInfoRow(title: String, value: String) {
Row(
horizontalArrangement = Arrangement.spacedBy(23.dp, Alignment.Start),
verticalAlignment = Alignment.Top,
) {
Text(
text = title,
style = TerningTheme.typography.body2,
color = Grey400,
)
Text(
text = value,
style = TerningTheme.typography.body3,
color = Grey375,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ data class ScrapDialogUiState(
val initialColorType: ColorType = ColorType.RED,
val selectedColorType: ColorType = ColorType.RED,
val isColorChanged: Boolean = false,
val isColorChangedOnce: Boolean = false,
)

0 comments on commit 20dfc25

Please sign in to comment.