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/#37] 캘린더뷰 / 스크랩 목록 뷰 #54

Merged
merged 25 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
06f12c6
[CHORE/#37] 스크랩 클래스 수정
boiledEgg-s Jul 10, 2024
d5b689e
[RENAME/#37] 스크랩 띠 이름 수정
boiledEgg-s Jul 10, 2024
db1e489
[ADD/#37] Coil 라이브러리 추가
boiledEgg-s Jul 10, 2024
b75787a
[MOVE/#37] 스크랩 박스 및 공고 정보뷰 위치 수정
boiledEgg-s Jul 10, 2024
ea21f7c
[CHORE/#37] 오류 로직 수정
boiledEgg-s Jul 10, 2024
efe9edd
[FEAT/#37] LocalDate 확장함수 추가
boiledEgg-s Jul 10, 2024
361d2f1
[ADD/#37] 스크랩 이미지 추가
boiledEgg-s Jul 10, 2024
2d24fa7
[UI/#37] 공고 목록 컴포넌트 구현
boiledEgg-s Jul 10, 2024
9951335
[UI/#37] 주간 캘린더 스크랩 목록 화면 구현
boiledEgg-s Jul 10, 2024
8304252
[MOD/#37] 기타 코드 수정
boiledEgg-s Jul 10, 2024
62712b1
[MOD/#37] 스크랩 목록 로직 변경
boiledEgg-s Jul 10, 2024
88d4ee9
[UI/#37] 스크랩 목록 화면 구현
boiledEgg-s Jul 10, 2024
6f90ba1
[CHORE/#37] 리스트 버튼 색상 변경
boiledEgg-s Jul 10, 2024
0b716ed
[CHORE/#37] 리스트 배경색 변경
boiledEgg-s Jul 10, 2024
f2b7b60
[UI/#37] 리스트 전환 애니메이션 구현
boiledEgg-s Jul 10, 2024
4aedbd6
[MOVE/#37] 탑바 패키지 이동
boiledEgg-s Jul 11, 2024
9af6162
[UI/#37] 패키지 구조 수정 및 리스트 로직 수정
boiledEgg-s Jul 11, 2024
3810802
[UI/#37] 패키지 구조 수정
boiledEgg-s Jul 11, 2024
1f55cf5
[UI/#37] 스크랩 목록 화면 스크롤 구현
boiledEgg-s Jul 11, 2024
bb2d5da
[REFACTOR/#37] 임포트 정리
boiledEgg-s Jul 11, 2024
40c8e0f
Merge remote-tracking branch 'origin/develop' into ui/#37-calendar-scrap
boiledEgg-s Jul 11, 2024
a123cf2
[UI/#37] 월간-주간-목록 전환 흐름 변경
boiledEgg-s Jul 11, 2024
ecf16b3
[CHORE/#37] 로직 오류 수정
boiledEgg-s Jul 11, 2024
8b77265
[CHORE/#37] InternItem 로직 수정
boiledEgg-s Jul 11, 2024
7203b87
[REFACTOR/#37] 리뷰 기반 코드 수정
boiledEgg-s 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
3 changes: 3 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ dependencies {
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)

//ThirdPartyDependencies
implementation(libs.compose.coil)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package com.terning.core.designsystem.component.item

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
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.fillMaxSize
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.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.terning.core.R
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningPointTheme
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.noRippleClickable

@Composable
fun InternItem(
imageUrl: String,
title: String,
dateDeadline: String,
workingPeriod: String,
isScraped: Boolean,
modifier: Modifier = Modifier,
scrapId: Int = 0,
onScrapButtonClicked: (Int) -> Unit = {},
) {
Row(
modifier = modifier
.padding(10.dp)
.fillMaxSize(),
) {
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(imageUrl)
.build(),
contentDescription = title,
Modifier
Copy link
Member

Choose a reason for hiding this comment

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

위에 있는 modifier 변수 사용해줘도 될 것 같아요!!

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를 적용하는 편입니다!!

.fillMaxHeight()
.aspectRatio(1f)
.clip(RoundedCornerShape(5.dp))
.background(color = Grey300)
)
Comment on lines +52 to +62
Copy link
Member

Choose a reason for hiding this comment

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

메모: 추후에 컴포넌트 빼놓기

Column(
modifier = Modifier
.padding(start = 8.dp)
.fillMaxHeight()
) {
Text(
text = stringResource(id = R.string.intern_item_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.fillMaxHeight(),
verticalAlignment = Alignment.Bottom
) {
Comment on lines +82 to +85
Copy link
Member

Choose a reason for hiding this comment

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

단순 궁금증인데,, 여기선 modifier 변수 안 써주는 이유가 있나용?

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를 적용하는 편입니다!!

Text(
text = stringResource(R.string.intern_item_working_period),
style = TerningTheme.typography.detail3,
color = Grey400
)

Text(
text = stringResource(id = R.string.intern_item_working_period_month, workingPeriod),
style = TerningTheme.typography.detail3,
color = TerningMain,
modifier = modifier
.padding(start = 4.dp)
)
}
}

Box(modifier = Modifier.fillMaxSize()) {
Image(
painter = painterResource(
id =
if (isScraped)
R.drawable.ic_bookmark_filled
else
R.drawable.ic_bookmark_outlined
),
contentDescription = stringResource(id = R.string.intern_item_scrap),
modifier = modifier
.align(Alignment.BottomEnd)
.noRippleClickable {
onScrapButtonClicked(scrapId)
},
)
}
}
}

@Preview(showBackground = true)
@Composable
fun InternItemPreview() {
TerningPointTheme {
Box(
modifier = Modifier
.height(height = 92.dp)
.fillMaxWidth(),
){
InternItem(
imageUrl = "",
title = "test title",
dateDeadline = "3",
workingPeriod = "6",
isScraped = true
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.terning.core.designsystem.component.box
package com.terning.core.designsystem.component.item

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.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.terning.feature.calendar.component
package com.terning.core.designsystem.component.topappbar

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand All @@ -15,19 +15,21 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.terning.core.R
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.TerningPointTheme
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.getStringAsTitle
import com.terning.core.extension.noRippleClickable
import com.terning.feature.R
import java.time.LocalDate

@Composable
fun CalendarTopBar(
fun CalendarTopAppBar(
modifier: Modifier = Modifier,
date: LocalDate,
isWeekExpanded: Boolean,
isListExpanded: Boolean,
onListButtonClicked: () -> Unit,
onMonthNavigationButtonClicked: (Int) -> Unit,
Expand All @@ -47,24 +49,28 @@ fun CalendarTopBar(
modifier = Modifier.align(Alignment.Center),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
painter = painterResource(id = R.drawable.ic_calendar_previous),
contentDescription = stringResource(id = R.string.calendar_button_description_previous),
tint = Grey300,
modifier = Modifier.noRippleClickable { onMonthNavigationButtonClicked(-1) }
)
if(!isWeekExpanded || isListExpanded) {
Icon(
painter = painterResource(id = R.drawable.ic_calendar_previous),
contentDescription = stringResource(id = R.string.calendar_button_description_previous),
tint = Grey300,
modifier = Modifier.noRippleClickable { onMonthNavigationButtonClicked(-1) }
)
}
Text(
text = date.getStringAsTitle(),
style = TerningTheme.typography.title2,
color = Black,
modifier = Modifier.padding(horizontal = 8.dp)
)
Icon(
painter = painterResource(id = R.drawable.ic_calendar_next),
contentDescription = stringResource(id = R.string.calendar_button_description_next),
tint = Grey300,
modifier = Modifier.noRippleClickable { onMonthNavigationButtonClicked(1) }
)
if(!isWeekExpanded || isListExpanded) {
Icon(
painter = painterResource(id = R.drawable.ic_calendar_next),
contentDescription = stringResource(id = R.string.calendar_button_description_next),
tint = Grey300,
modifier = Modifier.noRippleClickable { onMonthNavigationButtonClicked(1) }
)
}
}
Box(
modifier = Modifier
Expand All @@ -80,7 +86,7 @@ fun CalendarTopBar(
),
contentDescription = stringResource(id = R.string.calendar_button_description_list),
modifier = Modifier.noRippleClickable { onListButtonClicked() },
tint = if (isListExpanded) Color.Green else Color.LightGray,
tint = if (isListExpanded) TerningMain else Grey300,
)
}
}
Expand All @@ -90,9 +96,11 @@ fun CalendarTopBar(
@Composable
fun CalendarTopBarPreview() {
TerningPointTheme {
CalendarTopBar(
CalendarTopAppBar(
date = LocalDate.now(),
isListExpanded = false,
isWeekExpanded = false
,
onListButtonClicked = {},
onMonthNavigationButtonClicked = {}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package com.terning.core.extension

import java.time.LocalDate
import java.time.format.TextStyle
import java.util.Locale

fun LocalDate.getStringAsTitle(): String =
"${year}년 ${monthValue.toString().padStart(2, '0')}월"

fun LocalDate.getWeekIndexContainingSelectedDate(): Int = dayOfMonth / 7
fun LocalDate.getDateStringInKorean(): String =
"${monthValue}월 ${dayOfMonth}일 ${dayOfWeek.getDisplayName(TextStyle.FULL, Locale.KOREAN)}"
Comment on lines +10 to +11
Copy link
Member

Choose a reason for hiding this comment

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

와 한글로 바꿔주는 센스 미쳤네요


fun LocalDate.getWeekIndexContainingSelectedDate(inDays: Int): Int = (inDays + dayOfMonth - 1) / 7

fun LocalDate.isToday(): Boolean = this == LocalDate.now()
13 changes: 13 additions & 0 deletions core/src/main/res/drawable/ic_bookmark_filled.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M16,3H8C6.895,3 6,3.895 6,5V21L11.375,16.7C11.741,16.408 12.259,16.408 12.625,16.7L18,21V5C18,3.895 17.105,3 16,3Z"
android:strokeLineJoin="round"
android:strokeWidth="2.04"
android:fillColor="#1EAC61"
android:strokeColor="#1EAC61"
android:strokeLineCap="round"/>
</vector>
13 changes: 13 additions & 0 deletions core/src/main/res/drawable/ic_bookmark_outlined.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M16,3H8C6.895,3 6,3.895 6,5V21L11.375,16.7C11.741,16.408 12.259,16.408 12.625,16.7L18,21V5C18,3.895 17.105,3 16,3Z"
android:strokeLineJoin="round"
android:strokeWidth="2.04"
android:fillColor="#00000000"
android:strokeColor="#ADADAD"
android:strokeLineCap="round"/>
</vector>
11 changes: 11 additions & 0 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
<!-- button-->
<string name="button_preview">button</string>

<!-- Intern Item-->
<string name="intern_item_working_period">근무기간</string>
<string name="intern_item_working_period_month">%s개월</string>
<string name="intern_item_d_day">D-%s</string>
<string name="intern_item_scrap">스크랩</string>

<!-- Calendar-->
<string name="calendar_button_description_previous">previous</string>
<string name="calendar_button_description_next">next</string>
<string name="calendar_button_description_list">list</string>

<!-- 정렬 버튼 + 바텀시트 -->
<string name="sort_by_earliest">채용 마감 이른순</string>
<string name="sort_by_shortest">짧은 근무 기간순</string>
Expand Down
Loading
Loading