Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI/#80] 탐색 뷰 / 공고 컴포넌트 추가 #81

Merged
merged 8 commits into from
Jul 15, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.terning.core.designsystem.component.item

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.White
import com.terning.core.extension.customShadow

@Composable
fun InternItemWithShadow(
imageUrl: String,
title: String,
dateDeadline: String,
workingPeriod: String,
isScraped: Boolean,
) {
Box(
modifier = Modifier
.customShadow(
color = Grey200,
shadowRadius = 10.dp,
shadowWidth = 2.dp,
Comment on lines +25 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

흠 이게 아이템마다 radius가 다를 수 있어서 component로 뺄거면 이거도 파라미터로 받아와야 할 것 같아요..!!

)
.background(
color = White,
shape = RoundedCornerShape(10.dp)
)
) {
InternItem(
imageUrl = imageUrl,
title = title,
dateDeadline = dateDeadline,
workingPeriod = workingPeriod,
isScraped = isScraped
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ fun TerningBasicTextField(
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp),
modifier = Modifier.padding(vertical = 8.dp)
) {
helperIcon?.let {
Icon(
Expand Down
43 changes: 12 additions & 31 deletions feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
Expand All @@ -31,22 +30,19 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavHostController
import com.terning.core.designsystem.component.bottomsheet.SortingBottomSheet
import com.terning.core.designsystem.component.button.SortingButton
import com.terning.core.designsystem.component.item.InternItem
import com.terning.core.designsystem.component.item.InternItemWithShadow
import com.terning.core.designsystem.component.topappbar.LogoTopAppBar
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.extension.customShadow
import com.terning.feature.R
import com.terning.feature.home.changefilter.navigation.navigateChangeFilter
import com.terning.feature.home.home.component.HomeFilteringEmptyIntern
import com.terning.feature.home.home.component.HomeFilteringScreen
import com.terning.feature.home.home.component.HomeRecommendEmptyIntern
import com.terning.feature.home.home.component.HomeTodayEmptyIntern
import com.terning.feature.home.home.component.HomeTodayIntern
import com.terning.feature.home.home.model.RecommendInternData
import com.terning.feature.home.home.model.UserNameState
import com.terning.feature.home.home.model.UserScrapState

Expand Down Expand Up @@ -148,7 +144,17 @@ fun HomeScreen(

if (userNameState.internFilter != null && recommendInternData.isNotEmpty()) {
items(recommendInternData.size) { index ->
ShowRecommendIntern(recommendInternData[index])
Box(
modifier = Modifier.padding(horizontal = 24.dp)
) {
InternItemWithShadow(
imageUrl = recommendInternData[index].imgUrl,
title = recommendInternData[index].title,
dateDeadline = recommendInternData[index].dDay.toString(),
workingPeriod = recommendInternData[index].workingPeriod.toString(),
isScraped = recommendInternData[index].isScrapped,
)
}
}
}
}
Expand Down Expand Up @@ -243,29 +249,4 @@ private fun ShowInternFilter(userNameState: UserNameState, onChangeFilterClick:
)
}
}
}

@Composable
private fun ShowRecommendIntern(recommendInternData: RecommendInternData) {
Box(
modifier = Modifier
.padding(horizontal = 24.dp)
.customShadow(
color = Grey200,
shadowRadius = 10.dp,
shadowWidth = 2.dp
)
.background(
color = White,
shape = RoundedCornerShape(10.dp)
)
) {
InternItem(
imageUrl = recommendInternData.imgUrl,
title = recommendInternData.title,
dateDeadline = recommendInternData.dDay.toString(),
workingPeriod = recommendInternData.workingPeriod.toString(),
isScraped = recommendInternData.isScrapped,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import com.terning.core.designsystem.theme.CalGreen2
import com.terning.core.designsystem.theme.CalOrange1
import com.terning.core.designsystem.theme.CalPink
import com.terning.core.designsystem.theme.CalYellow
import com.terning.feature.home.home.model.InternData
import com.terning.feature.home.home.model.InternFilterData
import com.terning.feature.home.home.model.RecommendInternData
import com.terning.feature.home.home.model.ScrapData
import com.terning.feature.home.home.model.UserNameState
import com.terning.feature.home.home.model.UserScrapState
Expand All @@ -24,7 +24,7 @@ import javax.inject.Inject
class HomeViewModel @Inject constructor(

) : ViewModel() {
private val _userName by mutableStateOf<UserNameState>(
private val _userName by mutableStateOf(
UserNameState(
userName = "남지우자랑스러운티엘이되",
internFilter = InternFilterData(
Expand All @@ -37,15 +37,15 @@ class HomeViewModel @Inject constructor(
)
val userName get() = _userName

private val _scrapState = MutableStateFlow<UserScrapState>(
private val _scrapState = MutableStateFlow(
UserScrapState(
isScrapExist = true,
scrapData = getScrapData()
)
)
val scrapData get() = _scrapState.asStateFlow()

private val _recommendInternState = MutableStateFlow<List<RecommendInternData>>(
private val _recommendInternState = MutableStateFlow(
getRecommendData()
)
val recommendInternData get() = _recommendInternState.asStateFlow()
Expand All @@ -57,7 +57,6 @@ class HomeViewModel @Inject constructor(
fun setWorkingPeriod(workingPeriod: Int) {
userName.internFilter?.workingPeriod = workingPeriod
}

}

private fun getScrapData(): List<ScrapData> = listOf(
Expand Down Expand Up @@ -111,71 +110,71 @@ private fun getScrapData(): List<ScrapData> = listOf(
),
)

private fun getRecommendData(): List<RecommendInternData> = listOf(
RecommendInternData(
private fun getRecommendData(): List<InternData> = listOf(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[유한킴벌리] 그린캠프 w.대학생 숲 활동가",
dDay = 22,
workingPeriod = 2,
isScrapped = true,
),
RecommendInternData(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "ㅇㄻㅇㅁㄻㄹㅇㅁㅇㄹ",
dDay = 9,
workingPeriod = 6,
isScrapped = false,
),
RecommendInternData(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[유한킴벌리] 그린캠프 w.대학생 숲 활동가",
dDay = 2,
workingPeriod = 4,
isScrapped = true,
),
RecommendInternData(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[유한킴벌리] 그린캠프 w.대학생 숲 활동가",
dDay = 2,
workingPeriod = 4,
isScrapped = false,
),
RecommendInternData(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[유한킴벌리] 그린캠프 w.대학생 숲 활동가",
dDay = 2,
workingPeriod = 4,
isScrapped = true,
),
RecommendInternData(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[유한킴벌리] 그린캠프 w.대학생 숲 활동가",
dDay = 2,
workingPeriod = 4,
isScrapped = true,
),
RecommendInternData(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[유한킴벌리] 그린캠프 w.대학생 숲 활동가",
dDay = 2,
Comment on lines 154 to 159
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

레전드 센스쟁이 발생!!

workingPeriod = 4,
isScrapped = false,
),
RecommendInternData(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[유한킴벌리] 그린캠프 w.대학생 숲 활동가",
dDay = 2,
workingPeriod = 4,
isScrapped = true,
),
RecommendInternData(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[유한킴벌리] 그린캠프 w.대학생 숲 활동가",
dDay = 2,
workingPeriod = 4,
isScrapped = false,
),
RecommendInternData(
InternData(
imgUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[유한킴벌리] 그린캠프 w.대학생 숲 활동가",
dDay = 2,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terning.feature.home.home.model

data class RecommendInternData(
data class InternData(
val imgUrl: String,
val title: String,
val dDay: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fun InternCompanyInfo(modifier: Modifier) {
) {
Image(
painter = painterResource(
id = R.drawable.ic_nosearch
id = R.drawable.ic_empty_logo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네이밍 굿!!

),
modifier = modifier.fillMaxWidth(),
contentDescription = null,
Comment on lines 55 to 60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 서버에서 이미지 URL로 받는 거면 coil 사용해줘야 될 것 같아요!!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MainNavigator(
@Composable get() = navController
.currentBackStackEntryAsState().value?.destination

val startDestination = SignIn
val startDestination = Search

val currentTab: MainTab?
@Composable get() = MainTab.find { tab ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,4 @@ fun SearchScreen(
SearchInternList(type = InternListType.SCRAP)
}
}

}
Loading
Loading