-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/#57-게시글 목록 조회 UI를 구현한다 #60
The head ref may contain hidden characters: "Feat/57-\uAC8C\uC2DC\uAE00_\uBAA9\uB85D_\uC870\uD68C_ui\uB97C_\uAD6C\uD604\uD55C\uB2E4"
Changes from 21 commits
b4868ff
27c6192
038eb3c
16fadaa
10a6e5f
d7c8136
a09216d
5f024c0
f206048
0454238
1e7f6a7
92d3e28
700f690
7929d99
b969197
4a19142
6b02cfe
29611b1
419f456
94865c7
5940514
2153afc
022192c
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,41 @@ | ||
package com.withpeace.withpeace.core.designsystem.ui | ||
|
||
import androidx.compose.foundation.BorderStroke | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme | ||
|
||
@Composable | ||
fun WithpeaceCard( | ||
modifier: Modifier = Modifier, | ||
content: @Composable () -> Unit, | ||
) { | ||
Card( | ||
modifier = modifier, | ||
shape = RoundedCornerShape(5.dp), | ||
border = BorderStroke(width = 1.dp, color = WithpeaceTheme.colors.SystemGray2), | ||
colors = CardDefaults.cardColors( | ||
containerColor = WithpeaceTheme.colors.SystemWhite, | ||
), | ||
) { | ||
content() | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
private fun WithpeaceCardPreview() { | ||
WithpeaceTheme { | ||
WithpeaceCard { | ||
Text("haha") | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
package com.withpeace.withpeace.core.domain.model.post | ||
|
||
import java.time.LocalDateTime | ||
|
||
data class Post( | ||
val postId: Long, | ||
val title: String, | ||
val content: String, | ||
val postTopic: PostTopic, | ||
val createDate: LocalDateTime, | ||
val postImageUrl: String, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
package com.withpeace.withpeace.core.domain.model.post | ||
|
||
enum class PostTopic { | ||
FREEDOM, INFORMATION, QUESTION, LIVING, HOBBY, ECONOMY | ||
FREEDOM, INFORMATION, QUESTION, LIVING, HOBBY, ECONOMY; | ||
|
||
companion object { | ||
fun findIndex(postTopic: PostTopic) = entries.indexOf(postTopic) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("convention.android.base") | ||
id("convention.android.compose") | ||
} | ||
|
||
android { | ||
namespace = "com.withpeace.withpeace.core.ui" | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core:domain")) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> | ||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.withpeace.withpeace.core.ui | ||
|
||
import android.content.Context | ||
import java.time.Duration | ||
import java.time.LocalDateTime | ||
import java.time.format.DateTimeFormatter | ||
|
||
fun LocalDateTime.toRelativeString(context: Context): String { | ||
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. 해당 코드는 View에서만 사용되는게 맞을까요?! 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. 단위를 구분하는건 domain이고 글자를 표시하는 건 view라고 생각합니다! 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. 저도 어디에 위치해야 할지 조금 애매했는데요, isLessThanOneDay 같은 함수들을 Post 도메인 로직으로 옮기는게 좋아보일까요? 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. domain 사용성을 위해서 옮기는 것도 좋아보입니다! Date 관련 도메인 로직이 될 것 같은데 어떠신가요?! 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. PostDate라는 도메인 모델에 적용하고, Post객체가 PostDate를 사용하게끔 하면 될 것 같습니다! 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. 좋습니다! 👍 🥇 💯 |
||
val currentTime = LocalDateTime.now() | ||
val duration = Duration.between(this, currentTime) | ||
return when { | ||
duration.isLessThanOneMinute() -> context.getString( | ||
R.string.second_format, | ||
duration.seconds, | ||
) | ||
|
||
duration.isLessThanOneHour() -> context.getString( | ||
R.string.minute_format, | ||
duration.toMinutes(), | ||
) | ||
|
||
duration.isLessThanOneDay() -> context.getString( | ||
R.string.hour_format, | ||
duration.toHours(), | ||
) | ||
|
||
duration.isLessThanSevenDays() -> context.getString(R.string.day_format, duration.toDays()) | ||
else -> format(DateTimeFormatter.ofPattern(DATE_FORMAT)) | ||
} | ||
} | ||
|
||
private fun Duration.isLessThanOneMinute() = toMinutes() < 1 | ||
private fun Duration.isLessThanOneHour() = toHours() < 1 | ||
private fun Duration.isLessThanOneDay() = toDays() < 1 | ||
private fun Duration.isLessThanSevenDays() = toDays() < 7 | ||
|
||
private const val DATE_FORMAT = "MM월 DD일" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="32dp" android:viewportHeight="32" android:viewportWidth="24" android:width="24dp"> | ||
|
||
<path android:fillColor="#A7A7A7" android:pathData="M4.504,16.41V16.229C4.504,16.121 4.55,16.017 4.632,15.94C4.714,15.863 4.826,15.82 4.942,15.82C5.058,15.82 5.169,15.863 5.251,15.94C5.333,16.017 5.379,16.121 5.379,16.229V16.41C5.379,16.639 5.72,16.893 6.214,16.893C6.708,16.893 7.05,16.639 7.05,16.41V16.229C7.05,16 6.708,15.746 6.214,15.746C5.257,15.746 4.504,15.173 4.504,14.443V14.263C4.528,13.948 4.668,13.65 4.9,13.421C5.132,13.191 5.442,13.045 5.777,13.006V12.834C5.777,12.725 5.823,12.621 5.905,12.544C5.987,12.467 6.098,12.424 6.214,12.424C6.33,12.424 6.441,12.467 6.523,12.544C6.606,12.621 6.652,12.725 6.652,12.834V13.006C6.986,13.045 7.296,13.191 7.528,13.421C7.761,13.65 7.9,13.948 7.924,14.263V14.443C7.924,14.552 7.878,14.656 7.796,14.733C7.714,14.81 7.603,14.853 7.487,14.853C7.371,14.853 7.26,14.81 7.178,14.733C7.096,14.656 7.05,14.552 7.05,14.443V14.263C7.05,14.034 6.708,13.78 6.214,13.78C5.72,13.78 5.379,14.034 5.379,14.263V14.443C5.379,14.673 5.72,14.927 6.214,14.927C7.172,14.927 7.924,15.5 7.924,16.229V16.41C7.9,16.725 7.761,17.023 7.528,17.252C7.296,17.481 6.986,17.628 6.652,17.667V17.839C6.652,17.948 6.606,18.052 6.523,18.129C6.441,18.206 6.33,18.249 6.214,18.249C6.098,18.249 5.987,18.206 5.905,18.129C5.823,18.052 5.777,17.948 5.777,17.839V17.667C5.442,17.628 5.132,17.481 4.9,17.252C4.668,17.023 4.528,16.725 4.504,16.41ZM8.257,27.523V26.912C7.591,27.077 6.906,27.16 6.219,27.158C2.79,27.158 -0,25.151 -0,22.689V15.59C-0,13.133 2.79,11.121 6.219,11.121C8.493,11.121 10.478,12.006 11.563,13.317V4.469C11.563,2.011 14.353,0 17.781,0C21.21,0 24,2.007 24,4.469V18.683C24,20.346 22.688,21.87 20.685,22.636C20.685,22.689 20.685,22.742 20.685,22.796V27.531C20.685,29.989 17.895,32 14.466,32C11.038,32 8.257,29.997 8.257,27.531V27.523ZM9.131,22.783C9.131,24.799 11.528,26.433 14.475,26.433C17.423,26.433 19.819,24.795 19.819,22.783C19.819,20.772 17.423,19.134 14.475,19.134C11.528,19.134 9.131,20.78 9.131,22.796V22.783ZM9.131,25.151C9.131,27.166 11.528,28.801 14.475,28.801C17.423,28.801 19.819,27.162 19.819,25.151V25.057C18.735,26.368 16.758,27.252 14.475,27.252C12.192,27.252 10.216,26.368 9.131,25.057V25.151ZM23.125,16.299V16.205C22.041,17.516 20.064,18.4 17.781,18.4C15.498,18.4 13.517,17.528 12.433,16.217V16.311C12.45,17.098 12.798,17.847 13.399,18.396C13.756,18.351 14.115,18.327 14.475,18.327C16.169,18.298 17.819,18.835 19.128,19.842C21.45,19.424 23.121,17.962 23.121,16.311L23.125,16.299ZM12.433,11.576C12.433,13.591 14.829,15.226 17.777,15.226C20.725,15.226 23.121,13.587 23.121,11.576V11.494C22.036,12.805 20.06,13.69 17.777,13.69C15.494,13.69 13.517,12.793 12.433,11.494V11.576ZM12.433,9.208C12.433,11.224 14.829,12.858 17.777,12.858C20.725,12.858 23.121,11.22 23.121,9.208V9.114C22.036,10.425 20.06,11.31 17.777,11.31C15.494,11.31 13.517,10.425 12.433,9.11V9.208ZM23.121,6.751C22.036,8.061 20.06,8.946 17.777,8.946C15.494,8.946 13.517,8.053 12.433,6.742V6.837C12.433,8.852 14.829,10.486 17.777,10.486C20.725,10.486 23.121,8.848 23.121,6.837V6.751ZM12.433,13.952C12.433,15.967 14.829,17.602 17.777,17.602C20.725,17.602 23.121,15.963 23.121,13.952V13.858C22.036,15.168 20.06,16.053 17.777,16.053C15.494,16.053 13.517,15.181 12.433,13.849V13.952ZM11.558,17.864C10.474,19.175 8.497,20.059 6.214,20.059C3.931,20.059 1.937,19.166 0.87,17.856V17.95C0.87,19.965 3.267,21.6 6.214,21.6C7.056,21.604 7.892,21.465 8.681,21.19C9.273,20.177 10.217,19.383 11.357,18.941C11.488,18.628 11.557,18.295 11.558,17.958V17.864ZM0.87,20.322C0.87,22.337 3.267,23.971 6.214,23.971C6.905,23.972 7.591,23.877 8.252,23.689V22.796C8.255,22.577 8.28,22.359 8.326,22.144C7.638,22.323 6.928,22.413 6.214,22.415C3.94,22.415 1.955,21.53 0.87,20.219V20.322ZM19.815,27.437C18.73,28.748 16.754,29.632 14.471,29.632C12.188,29.632 10.211,28.748 9.127,27.437V27.531C9.127,29.546 11.523,31.181 14.471,31.181C17.418,31.181 19.815,29.542 19.815,27.531V27.437ZM23.117,18.585C22.273,19.551 21.117,20.233 19.824,20.531C20.142,20.911 20.382,21.343 20.532,21.804C22.119,21.145 23.121,19.957 23.121,18.683L23.117,18.585ZM12.433,4.469C12.433,6.484 14.829,8.119 17.777,8.119C20.725,8.119 23.121,6.48 23.121,4.469C23.121,2.458 20.742,0.815 17.777,0.815C14.812,0.815 12.433,2.454 12.433,4.469ZM0.87,15.59C0.87,17.606 3.267,19.24 6.214,19.24C9.162,19.24 11.558,17.593 11.558,15.59C11.558,13.587 9.162,11.941 6.214,11.941C3.267,11.941 0.87,13.567 0.87,15.59ZM8.257,26.056V24.545C7.591,24.709 6.906,24.792 6.219,24.791C3.945,24.791 1.959,23.906 0.875,22.595V22.689C0.875,24.705 3.271,26.339 6.219,26.339C6.909,26.34 7.596,26.244 8.257,26.056ZM14.033,24.889V25.061C14.033,25.17 14.08,25.274 14.162,25.351C14.244,25.427 14.355,25.471 14.471,25.471C14.587,25.471 14.698,25.427 14.78,25.351C14.862,25.274 14.908,25.17 14.908,25.061V24.889C15.243,24.85 15.553,24.703 15.785,24.474C16.017,24.244 16.157,23.947 16.181,23.631V23.451C16.181,22.722 15.429,22.149 14.471,22.149C13.977,22.149 13.635,21.895 13.635,21.665V21.485C13.635,21.256 13.977,21.001 14.471,21.001C14.965,21.001 15.306,21.256 15.306,21.485V21.665C15.306,21.774 15.352,21.878 15.434,21.955C15.516,22.032 15.627,22.075 15.743,22.075C15.859,22.075 15.971,22.032 16.053,21.955C16.135,21.878 16.181,21.774 16.181,21.665V21.485C16.157,21.17 16.017,20.872 15.785,20.642C15.553,20.413 15.243,20.266 14.908,20.227V20.055C14.908,19.947 14.862,19.843 14.78,19.766C14.698,19.689 14.587,19.646 14.471,19.646C14.355,19.646 14.244,19.689 14.162,19.766C14.08,19.843 14.033,19.947 14.033,20.055V20.227C13.699,20.266 13.389,20.413 13.157,20.642C12.925,20.872 12.785,21.17 12.761,21.485V21.665C12.761,22.398 13.513,22.968 14.471,22.968C14.965,22.968 15.306,23.222 15.306,23.451V23.631C15.306,23.861 14.965,24.115 14.471,24.115C13.977,24.115 13.635,23.861 13.635,23.631V23.451C13.635,23.343 13.59,23.238 13.507,23.162C13.425,23.085 13.314,23.042 13.198,23.042C13.082,23.042 12.971,23.085 12.889,23.162C12.807,23.238 12.761,23.343 12.761,23.451V23.631C12.785,23.947 12.925,24.244 13.157,24.474C13.389,24.703 13.699,24.85 14.033,24.889ZM17.34,6.579V6.751C17.34,6.859 17.386,6.963 17.468,7.04C17.55,7.117 17.661,7.16 17.777,7.16C17.893,7.16 18.004,7.117 18.086,7.04C18.168,6.963 18.214,6.859 18.214,6.751V6.579C18.549,6.54 18.859,6.393 19.091,6.163C19.323,5.934 19.463,5.636 19.487,5.321V5.141C19.487,4.408 18.735,3.838 17.777,3.838C17.283,3.838 16.942,3.584 16.942,3.355V3.175C16.942,2.945 17.283,2.691 17.777,2.691C18.271,2.691 18.612,2.945 18.612,3.175V3.355C18.612,3.463 18.658,3.568 18.74,3.644C18.822,3.721 18.934,3.764 19.049,3.764C19.166,3.764 19.277,3.721 19.359,3.644C19.441,3.568 19.487,3.463 19.487,3.355V3.175C19.463,2.859 19.323,2.562 19.091,2.332C18.859,2.103 18.549,1.956 18.214,1.917V1.745C18.214,1.636 18.168,1.532 18.086,1.455C18.004,1.379 17.893,1.335 17.777,1.335C17.661,1.335 17.55,1.379 17.468,1.455C17.386,1.532 17.34,1.636 17.34,1.745V1.917C17.005,1.956 16.695,2.103 16.463,2.332C16.231,2.562 16.091,2.859 16.067,3.175V3.355C16.067,4.088 16.819,4.657 17.777,4.657C18.271,4.657 18.612,4.911 18.612,5.141V5.321C18.612,5.55 18.271,5.804 17.777,5.804C17.283,5.804 16.942,5.55 16.942,5.321V5.141C16.942,5.032 16.896,4.928 16.814,4.851C16.732,4.774 16.62,4.731 16.504,4.731C16.388,4.731 16.277,4.774 16.195,4.851C16.113,4.928 16.067,5.032 16.067,5.141V5.321C16.091,5.636 16.231,5.934 16.463,6.163C16.695,6.393 17.005,6.54 17.34,6.579Z"/> | ||
|
||
</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.
어디에 쓰이는 카드인가요?!
캡쳐 해주시면 감사합니다
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.
게시글 내용을 감싸는 테두리 라고 생각하시면 될 것 같습니다! 보통 저 테두리는 공통으로 쓰이기 때문에 designSystem으로 빼놨습니다