-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from all commits
06f12c6
d5b689e
db1e489
b75787a
ea21f7c
efe9edd
361d2f1
2d24fa7
9951335
8304252
62712b1
88d4ee9
6f90ba1
0b716ed
f2b7b60
4aedbd6
9af6162
3810802
1f55cf5
bb2d5da
40c8e0f
a123cf2
ecf16b3
8b77265
7203b87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
.fillMaxHeight() | ||
.aspectRatio(1f) | ||
.clip(RoundedCornerShape(5.dp)) | ||
.background(color = Grey300) | ||
) | ||
Comment on lines
+52
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 단순 궁금증인데,, 여기선 modifier 변수 안 써주는 이유가 있나용? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 전 최상위 컴포저블에만 |
||
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,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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() |
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> |
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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
위에 있는 modifier 변수 사용해줘도 될 것 같아요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전 최상위 컴포저블에만 modifier를 적용하는 편입니다!!