Skip to content

Commit

Permalink
[MERGE] #191 -> develop
Browse files Browse the repository at this point in the history
[UI/#191] 공고 상세 뷰 / 2차 UI로 전면 수정
  • Loading branch information
arinming authored Sep 6, 2024
2 parents 171dac8 + 1892ea7 commit a6569b5
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 333 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ val Grey150 = Color(0xFFE9E9E9)
val Grey200 = Color(0xFFDDDDDD)
val Grey300 = Color(0xFFBCBCBC)
val Grey350 = Color(0xFFADADAD)
val Grey375 = Color(0xFF898989)
val Grey400 = Color(0xFF666666)
val Grey500 = Color(0xFF373737)
val Black = Color(0xFF171717)
Expand Down
301 changes: 72 additions & 229 deletions feature/src/main/java/com/terning/feature/intern/InternRoute.kt

Large diffs are not rendered by default.

37 changes: 17 additions & 20 deletions feature/src/main/java/com/terning/feature/intern/InternViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import com.terning.domain.repository.InternRepository
import com.terning.domain.repository.ScrapRepository
import com.terning.feature.R
import com.terning.feature.intern.model.InternScrapState
import com.terning.feature.intern.model.InternViewState
import com.terning.feature.intern.model.InternUiState
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
Expand All @@ -25,9 +24,8 @@ class InternViewModel @Inject constructor(
private val internRepository: InternRepository,
private val scrapRepository: ScrapRepository,
) : ViewModel() {
private val _internState: MutableStateFlow<InternViewState> =
MutableStateFlow(InternViewState())
val internState: StateFlow<InternViewState> = _internState.asStateFlow()
private val _internUiState = MutableStateFlow(InternUiState())
val internUiState get() = _internUiState.asStateFlow()

private val _scrapState: MutableStateFlow<InternScrapState> =
MutableStateFlow(InternScrapState())
Expand All @@ -37,20 +35,19 @@ class InternViewModel @Inject constructor(

fun getInternInfo(id: Long) {
viewModelScope.launch {
internRepository.getInternInfo(
id
).onSuccess { internInfo ->
_internState.update {
it.copy(internInfo = UiState.Success(internInfo))
internRepository.getInternInfo(id)
.onSuccess { internInfoModel ->
_internUiState.update { currentState ->
currentState.copy(loadState = UiState.Success(internInfoModel))
}
}
.onFailure {
_sideEffect.emit(InternViewSideEffect.Toast(R.string.server_failure))
}
}.onFailure {
_sideEffect.emit(
InternViewSideEffect.Toast(R.string.server_failure)
)
}
}
}


fun postScrap(
id: Long,
color: Int,
Expand Down Expand Up @@ -100,31 +97,31 @@ class InternViewModel @Inject constructor(
}

fun updateSelectColor(newColor: Color) {
_internState.update {
_internUiState.update {
it.copy(selectedColor = newColor)
}
}

fun updateScrapDialogVisible(visible: Boolean) {
_internState.update {
_internUiState.update {
it.copy(isScrapDialogVisible = visible)
}
}

fun updatePaletteOpen(open: Boolean) {
_internState.update {
_internUiState.update {
it.copy(isPaletteOpen = open)
}
}

fun updateColorChange(change: Boolean) {
_internState.update {
_internUiState.update {
it.copy(isColorChange = change)
}
}

fun updateShowWeb(show: Boolean) {
_internState.update {
_internUiState.update {
it.copy(showWeb = show)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.Grey350
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.feature.R

Expand All @@ -36,70 +36,55 @@ fun InternCompanyInfo(
company: String,
companyCategory: String,
) {
Row(
modifier = modifier.padding(
start = 20.dp,
)
Column(
modifier = Modifier
.fillMaxWidth(),
verticalArrangement = Arrangement.Top,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Column(
verticalArrangement = Arrangement.spacedBy(
2.dp,
Alignment.CenterVertically
),
horizontalAlignment = Alignment.Start,
) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.size(60.dp)
.border(
width = 1.dp,
color = TerningMain,
shape = RoundedCornerShape(size = 30.dp)
)
) {
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(companyImage)
.crossfade(true)
.build(),
contentDescription = stringResource(id = R.string.search_image),
contentScale = ContentScale.Fit,
modifier = modifier
.fillMaxWidth()
.clip(CircleShape),
)
}
}
Column(
verticalArrangement = Arrangement.spacedBy(
3.dp,
Alignment.Bottom
),
horizontalAlignment = Alignment.Start,
modifier = modifier
.padding(
horizontal = 12.dp
)
) {
Text(
text = company,
style = TerningTheme.typography.title4,
color = Black,
modifier = modifier.padding(top = 11.dp),
maxLines = MAX_LINES,
overflow = TextOverflow.Ellipsis
)
Text(
text = companyCategory,
style = TerningTheme.typography.body4,
color = Grey300,
modifier = modifier.padding(bottom = 6.dp)
modifier = Modifier
.size(128.dp)
.border(
width = 1.dp,
color = Grey150,
shape = RoundedCornerShape(size = 20.dp)
)
}
) {
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.crossfade(true)
.data(companyImage)
.build(),
contentDescription = stringResource(id = R.string.search_image),
contentScale = ContentScale.Fit,
modifier = Modifier
.fillMaxWidth()
.clip(CircleShape),
)
}
Column(
verticalArrangement = Arrangement.spacedBy(
4.dp,
Alignment.Bottom
),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
text = company,
style = TerningTheme.typography.title4,
color = Black,
modifier = modifier.padding(top = 20.dp),
maxLines = MAX_LINES,
overflow = TextOverflow.Ellipsis
)
Text(
text = companyCategory,
style = TerningTheme.typography.body4,
color = Grey350,
modifier = modifier.padding(bottom = 8.dp)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ 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.Black
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.Grey500
import com.terning.core.designsystem.theme.TerningTheme

@Composable
fun InternInfoRow(title: String, value: String) {
Row(
horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.Start),
horizontalArrangement = Arrangement.spacedBy(23.dp, Alignment.Start),
verticalAlignment = Alignment.Top,
) {
Text(
text = title,
style = TerningTheme.typography.body2,
color = Black,
color = Grey500,
)
Text(
text = value,
style = TerningTheme.typography.body3,
color = Grey500,
color = Grey400,
)
}
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
package com.terning.feature.intern.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.material3.VerticalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningSub4
import com.terning.core.designsystem.theme.TerningTheme

@Composable
fun InternPageTitle(
modifier: Modifier,
text: String
text: String,
) {
Row(
modifier = modifier
.height(IntrinsicSize.Min)
.fillMaxWidth()
.padding(
top = 16.dp,
bottom = 16.dp
top = 7.dp,
bottom = 6.dp,
)
.background(TerningSub4)
) {
VerticalDivider(
color = TerningMain,
thickness = 2.dp,
)
Text(
text = text,
style = TerningTheme.typography.title4,
color = TerningMain,
color = Black,
modifier = modifier.padding(
top = 7.dp,
bottom = 6.dp,
start = 20.dp
start = 8.dp
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.terning.feature.intern.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
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.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.component.image.TerningImage
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey375
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningSub3
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.feature.R


@Composable
fun InternTitle(
modifier: Modifier,
dDay: String,
title: String,
viewCount: String,
) {
Column(
modifier = modifier
.fillMaxWidth(),
) {
Row(
modifier = Modifier
.background(
color = TerningSub3,
shape = RoundedCornerShape(size = 5.dp)
),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = dDay,
style = TerningTheme.typography.title3,
color = TerningMain,
modifier = Modifier.padding(
horizontal = 19.5.dp,
vertical = 1.5.dp
)
)
}

Text(
text = title,
style = TerningTheme.typography.heading2,
color = Black,
modifier = modifier.padding(
top = 8.dp,
bottom = 4.dp
)
)

Row(
horizontalArrangement = Arrangement.spacedBy(3.dp, Alignment.Start),
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
) {
TerningImage(
painter = R.drawable.ic_view_count_14
)
Text(
text = stringResource(id = R.string.intern_view_count_detail, viewCount),
style = TerningTheme.typography.detail2,
color = Grey375,
)
}
}
}
Loading

0 comments on commit a6569b5

Please sign in to comment.