-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
29 changed files
with
664 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
) | ||
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 | ||
) { | ||
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 | ||
) | ||
} | ||
} | ||
} |
4 changes: 1 addition & 3 deletions
4
...re/designsystem/component/box/ScrapBox.kt → ...e/designsystem/component/item/ScrapBox.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)}" | ||
|
||
fun LocalDate.getWeekIndexContainingSelectedDate(inDays: Int): Int = (inDays + dayOfMonth - 1) / 7 | ||
|
||
fun LocalDate.isToday(): Boolean = this == LocalDate.now() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.