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/#12] 홈뷰 / 홈 기본 화면 구현 #47

Merged
merged 35 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d6db787
[FEAT/#12] 오늘 마감 공고 아이템 구현
Hyobeen-Park Jul 6, 2024
593b707
[ADD/#12] 스크랩 아이콘 추가
Hyobeen-Park Jul 6, 2024
d23b9b3
[FEAT/#12] 맞춤 공고 아이템 구현
Hyobeen-Park Jul 6, 2024
8eb37ba
[FEAT/#12] string 추출
Hyobeen-Park Jul 6, 2024
5dce0bd
[FEAT/#12] 홈뷰 오늘 마감 공고 타이틀 구현
Hyobeen-Park Jul 6, 2024
4ec2e76
[FEAT/#12] 홈뷰 스크랩 없을 때 오늘 마감 공고 뷰 구현
Hyobeen-Park Jul 6, 2024
e38ec2a
[FEAT/#12] 홈뷰 오늘 마감 없을 때 공고 뷰 구현
Hyobeen-Park Jul 6, 2024
a9a3665
[FEAT/#12] 오늘 마감 공고 뷰 구현
Hyobeen-Park Jul 6, 2024
7a0d58c
[FEAT/#12] 맞춤 공고 타이틀 구현
Hyobeen-Park Jul 6, 2024
0d85002
Merge remote-tracking branch 'origin/develop' into ui/#12-home-view-ui
Hyobeen-Park Jul 9, 2024
0b11124
[FEAT/#12] 오늘 마감 공고 컴포넌트 병합
Hyobeen-Park Jul 9, 2024
659d98a
Merge remote-tracking branch 'origin/develop' into ui/#12-home-view-ui
Hyobeen-Park Jul 9, 2024
8ba4ec0
[CHORE/#12] 임시 탑앱바 삭제
Hyobeen-Park Jul 9, 2024
01d3adb
Merge remote-tracking branch 'origin/develop' into ui/#12-home-view-ui
Hyobeen-Park Jul 9, 2024
0fb9618
[ADD/#12] 필터링 아이콘 추가
Hyobeen-Park Jul 9, 2024
2e49fae
[FEAT/#12] 필터링 ui 구현
Hyobeen-Park Jul 9, 2024
eb770f8
[CHORE/#12] 필터링 패딩 추가
Hyobeen-Park Jul 9, 2024
adb4bf5
[FEAT/#12] 맞춤 공고 ui 구현
Hyobeen-Park Jul 9, 2024
3f4a516
Merge remote-tracking branch 'origin/develop' into ui/#12-home-view-ui
Hyobeen-Park Jul 10, 2024
35a605c
[ADD/#12] 아이콘 추가
Hyobeen-Park Jul 10, 2024
eae5dd3
[Feat/#12] string 추가
Hyobeen-Park Jul 10, 2024
4e3100d
[FEAT/#12] 맞춤 인턴 공고 없을 때 UI 구현
Hyobeen-Park Jul 10, 2024
b7a2fe5
[REFACTOR/#12] 컴포넌트 분리 및 이름 수정
Hyobeen-Park Jul 10, 2024
7d7ddaa
[CHORE/#12] 패딩 위치 수정
Hyobeen-Park Jul 10, 2024
7f9c31a
[MOD/#12] 그림자 수정
Hyobeen-Park Jul 10, 2024
6aa7d30
[DEL/#12] HomeRecommendIntern 삭제
Hyobeen-Park Jul 10, 2024
1d02110
[FEAT/#12] stickyHeader 구현
Hyobeen-Park Jul 10, 2024
356d1da
[CHORE/#12] 코드 정리
Hyobeen-Park Jul 10, 2024
4d15952
Merge remote-tracking branch 'origin/develop' into ui/#12-home-view-ui
Hyobeen-Park Jul 11, 2024
c4dfed4
[CHORE/#12] conflict 수정
Hyobeen-Park Jul 11, 2024
176f5cb
[CHORE/#12] named argument 수정
Hyobeen-Park Jul 11, 2024
0ef202b
[REFACTOR/#12] 패키지 경로 수정
Hyobeen-Park Jul 11, 2024
42d9583
[MOD/#12] 필터링 월 -> 년+월로 수정
Hyobeen-Park Jul 11, 2024
9a833d3
Merge remote-tracking branch 'origin/develop' into ui/#12-home-view-ui
Hyobeen-Park Jul 11, 2024
c5a352a
[CHORE/#12] string 수정
Hyobeen-Park Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions feature/src/main/java/com/terning/feature/home/HomeRoute.kt

This file was deleted.

118 changes: 118 additions & 0 deletions feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package com.terning.feature.home.home

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
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.material3.HorizontalDivider
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
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.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.feature.R
import com.terning.feature.home.home.component.HomeFilteringScreen
import com.terning.feature.home.home.component.HomeTodayIntern

@Composable
fun HomeRoute() {
HomeScreen()
}

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun HomeScreen() {
Scaffold(
modifier = Modifier,
topBar = {
LogoTopAppBar()
}
) { paddingValues ->
LazyColumn(
modifier = Modifier
.fillMaxSize()
.padding(top = paddingValues.calculateTopPadding())
) {
item {
Column(
modifier = Modifier
.padding(bottom = 16.dp)
) {
Text(
text = stringResource(
id = R.string.home_today_title_start
)
+ "남지우"
+ stringResource(
id = R.string.home_today_title_end
),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Text(
text = stringResource(
id = R.string.home_today_title_start
)
+ "남지우"
+ stringResource(
id = R.string.home_today_title_end
),
Text(
text = stringResource(id = R.string.home_today_title, "남지우"
),

와 같은 방식으로 수정하는게 좋아보여요!!
문자열 리소스에서 변수를 넣을 부분을 %s로 지정하면 됩니다!!

Copy link
Member Author

Choose a reason for hiding this comment

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

와우 진짜 감사합니다!!

modifier = Modifier
.padding(top = 11.dp)
.padding(horizontal = 24.dp),
style = TerningTheme.typography.title1,
color = Black,
)
HomeTodayIntern()
}
}
stickyHeader {
Column(
modifier = Modifier
.background(White)
) {
Text(
text = stringResource(id = R.string.home_recommend_sub_title),
style = TerningTheme.typography.detail2,
color = Black,
modifier = Modifier
.padding(top = 25.dp)
.padding(horizontal = 24.dp),
)

Text(
text = stringResource(id = R.string.home_recommend_main_title),
style = TerningTheme.typography.title1,
color = Black,
modifier = Modifier
.padding(top = 5.dp)
.padding(horizontal = 24.dp),
)

HomeFilteringScreen(
grade = 3,
period = 1,
startYear = 2024,
startMonth = 7,
)

HorizontalDivider(
thickness = 4.dp,
color = Grey150,
modifier = Modifier
.fillMaxWidth(),
)
}
}

items(10) {
TerningPostItem(
imageUrl = "https://reqres.in/img/faces/7-image.jpg",
title = "[Someone] 콘텐츠 마케터 대학생 인턴 채용",
dateDeadline = "2",
workingPeriod = "2개월",
isScraped = false,
)
}
}

}
}
111 changes: 111 additions & 0 deletions feature/src/main/java/com/terning/feature/home/home/TerningPostItem.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package com.terning.feature.home.home

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
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.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import coil.compose.rememberImagePainter
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.feature.R

@Composable
fun TerningPostItem(
imageUrl: String,
title: String,
dateDeadline: String,
workingPeriod: String,
isScraped: Boolean,
modifier: Modifier = Modifier,
) {
Row(
modifier
.fillMaxWidth()
.height(92.dp)
.shadow(1.dp)
.background(
color = White,
shape = RoundedCornerShape(10.dp)
)
.padding(start = 10.dp, end = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Image(
painter = rememberImagePainter(imageUrl),
contentDescription = title,
modifier
.fillMaxHeight()
.aspectRatio(1f)
.padding(vertical = 10.dp)
.clip(
RoundedCornerShape(5.dp),
)
)
Column(
modifier
.padding(
top = 10.dp,
bottom = 9.dp,
start = 8.dp
)
.weight(1f),
) {
Text(
text = stringResource(id = R.string.terning_post_d_day) + dateDeadline,
style = TerningTheme.typography.detail0,
color = TerningMain,
)

Text(
text = title,
style = TerningTheme.typography.title5,
color = Black,
softWrap = true,
modifier = modifier.padding(top = 3.dp),
)

Row(
modifier = modifier
.padding(top = 10.dp)
) {
Text(
text = stringResource(R.string.terning_post_working_period),
style = TerningTheme.typography.detail3,
color = Grey400
)

Text(
text = workingPeriod,
style = TerningTheme.typography.detail3,
color = TerningMain,
modifier = modifier.padding(start = 4.dp)
)
}
}
Image(
painter = painterResource(id = R.drawable.ic_home_bookmark_28),
contentDescription = "scrap",
modifier = modifier
.padding(end = 2.dp, bottom = 8.dp)
.align(Alignment.Bottom),
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package com.terning.feature.home.home.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.material3.VerticalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
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 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.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.feature.R

@Composable
fun HomeFilteringScreen(
grade: Int,
period: Int,
startYear: Int,
startMonth: Int,
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier
.padding(top = 10.dp, bottom = 11.dp)
.padding(horizontal = 24.dp)
.height(IntrinsicSize.Min)
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
Row(
modifier = modifier
.background(
color = TerningMain,
shape = RoundedCornerShape(5.dp),
)
.align(Alignment.CenterVertically),
) {
Image(
painter = painterResource(id = R.drawable.ic_home_filtering_28),
contentDescription = stringResource(id = R.string.home_recommend_filtering),
modifier = modifier
.padding(horizontal = 2.dp),
)
Text(
text = stringResource(id = R.string.home_recommend_filtering),
style = TerningTheme.typography.button4,
color = White,
textAlign = TextAlign.Center,
modifier = modifier
.padding(end = 6.dp)
.align(Alignment.CenterVertically)
)
}

HomeFilteringText(
text = grade.toString() + stringResource(id = R.string.home_recommend_filtering_grade),
modifier = Modifier
.padding(vertical = 7.dp)
)
HomeFilteringDivider()
HomeFilteringText(
text = stringResource(
id = when (period) {
1 -> R.string.home_recommend_filtering_working_period_1
2 -> R.string.home_recommend_filtering_working_period_2
3 -> R.string.home_recommend_filtering_working_period_3
else -> R.string.server_failure
}
),
modifier = Modifier
.padding(vertical = 7.dp)
)
HomeFilteringDivider()
HomeFilteringText(
text = startYear.toString() + stringResource(id = R.string.home_recommend_filtering_startYear)
+ " " + startMonth.toString() + stringResource(id = R.string.home_recommend_filtering_startMonth),
modifier = Modifier
.padding(vertical = 7.dp)
)
}
}

@Composable
private fun HomeFilteringText(
text: String,
modifier: Modifier = Modifier
) {
Text(
text = text,
style = TerningTheme.typography.detail2,
color = Black,
modifier = modifier,
)
}

@Composable
private fun HomeFilteringDivider() {
VerticalDivider(
color = Grey300,
thickness = 2.dp,
modifier = Modifier
.fillMaxHeight()
.padding(vertical = 4.dp),
)
}
Loading
Loading