-
Notifications
You must be signed in to change notification settings - Fork 8
2주차 미션 / 2조 조은서 #16
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
base: taskcho123
Are you sure you want to change the base?
2주차 미션 / 2조 조은서 #16
Changes from all commits
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,22 @@ | ||
| - 제목: | ||
| N주차 미션 / N조 000 (확인 후 지워주세요) | ||
|
|
||
| ## 1. 미션 | ||
| 각 주차에 해당하는 미션 체크리스트 | ||
|
|
||
| - | ||
|
|
||
| ## 2. 구현에 대한 설명 | ||
| 본인이 구현한 것에 대한 설명 | ||
|
|
||
| - | ||
|
|
||
| ## 3. 스크린샷 & 실행영상 | ||
| 실행영상이 있다면 실행영상을, 없다면 스크린샷 첨부 | ||
|
|
||
| - | ||
|
|
||
| ## 4. 기타 | ||
| 기타 문의사항이나 질문사항, 그 외 하고싶은 말 | ||
|
|
||
| - |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import android.R.attr.text | ||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.text.font.FontWeight | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.sp | ||
|
|
||
| @Composable | ||
| fun Filter(modifier: Modifier = Modifier) { | ||
| Row( | ||
| modifier = Modifier.fillMaxWidth(), | ||
| horizontalArrangement = Arrangement.SpaceBetween | ||
| ) { | ||
| Text( | ||
| text = "Latest", | ||
| color = Color.Black, | ||
| fontSize = 16.sp, | ||
| fontWeight = FontWeight.SemiBold, | ||
| modifier = Modifier.clickable {} | ||
| ) | ||
| Text( | ||
| text = "See all", | ||
| color = Color(0xFF4E4B66), | ||
| fontSize = 14.sp, | ||
| modifier = Modifier.clickable {} | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun PreviewFilter() { | ||
| Filter() | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.lazy.LazyRow | ||
| import androidx.compose.foundation.lazy.items | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import androidx.compose.ui.unit.sp | ||
| import com.example.kuit7.data.LabelItem | ||
|
|
||
| @Composable | ||
| fun Label(modifier: Modifier = Modifier) { | ||
| LazyRow( | ||
| horizontalArrangement = Arrangement.spacedBy(10.dp) | ||
| ) { | ||
| items(LabelItem.getLabelList()){ item -> | ||
| Text(text = item, fontSize = 16.sp) | ||
|
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. if 를 사용해서 color 속성을 바꿔주면 피그마 디자인과 일치시킬 수 있습니다! |
||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun PreviewLazyRow() { | ||
| Label() | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| import androidx.compose.foundation.Image | ||
| import androidx.compose.foundation.border | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.Spacer | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.lazy.LazyColumn | ||
| import androidx.compose.foundation.lazy.items | ||
| 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.graphics.Color | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.text.font.FontWeight | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import androidx.compose.ui.unit.sp | ||
| import com.example.kuit7.data.NewsItem | ||
|
|
||
| @Composable | ||
| fun News(modifier: Modifier = Modifier) { | ||
| LazyColumn( | ||
| verticalArrangement = Arrangement.spacedBy(16.dp) | ||
| ) { | ||
| items(NewsItem.getNewsItemList()){item -> | ||
| Row( | ||
|
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 = Modifier | ||
| .padding(8.dp) | ||
| .fillMaxWidth(), | ||
| horizontalArrangement = Arrangement.spacedBy(4.dp), | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| Image( | ||
| painter = painterResource(item.image), | ||
| contentDescription = "thumbnail", | ||
| modifier = Modifier | ||
| .size(96.dp) | ||
| .clip(shape = RoundedCornerShape(5.dp)) | ||
| ) | ||
| Column( | ||
| verticalArrangement = Arrangement.spacedBy(4.dp) | ||
| ) { | ||
| Text( | ||
| text = item.label, | ||
| fontSize = 13.sp, | ||
| color = Color(0xFF4E4B66) | ||
| ) | ||
| Text( | ||
|
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. 긴 텍스트에 대응하기 위해 maxLines/overflow 처리가 필요해 보입니다! |
||
| text = item.content, | ||
| fontSize = 16.sp, | ||
| color = Color.Black | ||
| ) | ||
| Row( | ||
| horizontalArrangement = Arrangement.spacedBy(8.dp) | ||
| ) { | ||
| Text( | ||
| text = item.company, | ||
| fontSize = 13.sp, | ||
| fontWeight = FontWeight.SemiBold, | ||
| color = Color(0xFF4E4B66) | ||
| ) | ||
| Text( | ||
| text = item.time, | ||
| fontSize = 13.sp, | ||
| color = Color(0xFF4E4B66) | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun PreviewNews() { | ||
| News() | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import android.media.Image | ||
| import androidx.compose.foundation.Image | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.example.kuit7.R | ||
|
|
||
| @Composable | ||
| fun Title(modifier: Modifier = Modifier) { | ||
| Box( | ||
| modifier = Modifier | ||
| .padding(0.dp, 0.dp, 0.dp, 26.dp) | ||
| .size(width = 100.dp, height = 30.dp) | ||
|
|
||
| ) { | ||
| Image( | ||
| painter = painterResource(R.drawable.title), | ||
| contentDescription = "logo", | ||
| modifier = Modifier.fillMaxSize() | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun PreviewTitle() { | ||
| Title() | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.example.kuit7.data | ||
|
|
||
| object LabelItem { | ||
| fun getLabelList() = listOf<String>( | ||
| "All", | ||
| "Sports", | ||
| "Politics", | ||
| "Business", | ||
| "Health", | ||
| "Travel", | ||
| "Science", | ||
| "Economy", | ||
| "Music" | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| package com.example.kuit7.data | ||
|
|
||
| import android.R.attr.type | ||
| import android.media.Image | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.foundation.Image | ||
| import com.example.kuit7.R | ||
|
|
||
| data class NewsItemData ( | ||
| val label: String, | ||
| val content: String, | ||
| val company: String, | ||
| val time: String, | ||
| val image: Int | ||
| ) | ||
| object NewsItem { | ||
| fun getNewsItemList() = listOf<NewsItemData>( | ||
| NewsItemData( | ||
| label = "Europe", | ||
| content = "Ukraine's President Zelensky to BBC: Blood money being paid...", | ||
| company = "BBC News", | ||
| time = "14m ago", | ||
| image = R.drawable.news1 | ||
| ), | ||
| NewsItemData( | ||
| label = "Travel", | ||
| content = "Ukraine's President Zelensky to BBC: Blood money being paid...", | ||
| company = "BBC News", | ||
| time = "14m ago", | ||
| image = R.drawable.news2, | ||
| ), | ||
| NewsItemData( | ||
| label = "Europe", | ||
| content = "Ukraine's President Zelensky to BBC: Blood money being paid...", | ||
| company = "BBC News", | ||
| time = "14m ago", | ||
| image = R.drawable.news3, | ||
| ), | ||
| NewsItemData( | ||
| label = "Money", | ||
| content = "Ukraine's President Zelensky to BBC: Blood money being paid...", | ||
| company = "BBC News", | ||
| time = "14m ago", | ||
| image = R.drawable.news4, | ||
| ), | ||
| NewsItemData( | ||
| label = "Life", | ||
| content = "Ukraine's President Zelensky to BBC: Blood money being paid...", | ||
| company = "BBC News", | ||
| time = "14m ago", | ||
| image = R.drawable.news5, | ||
| ), | ||
| NewsItemData( | ||
| label = "Europe", | ||
| content = "Ukraine's President Zelensky to BBC: Blood money being paid...", | ||
| company = "BBC News", | ||
| time = "14m ago", | ||
| image = R.drawable.news3, | ||
| ), | ||
| NewsItemData( | ||
| label = "Money", | ||
| content = "Ukraine's President Zelensky to BBC: Blood money being paid...", | ||
| company = "BBC News", | ||
| time = "14m ago", | ||
| image = R.drawable.news4, | ||
| ), | ||
| NewsItemData( | ||
| label = "Life", | ||
| content = "Ukraine's President Zelensky to BBC: Blood money being paid...", | ||
| company = "BBC News", | ||
| time = "14m ago", | ||
| image = R.drawable.news5, | ||
| ) | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
|
|
||
| @Composable | ||
| fun Week02(modifier: Modifier = Modifier) { | ||
| Box( | ||
| modifier = Modifier.padding(24.dp) | ||
|
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( | ||
| verticalArrangement = Arrangement.spacedBy(16.dp), | ||
| horizontalAlignment = Alignment.CenterHorizontally | ||
| ) { | ||
| Title() | ||
| Filter() | ||
| Label() | ||
| News() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun PreviewWeek02() { | ||
| Week02() | ||
| } | ||
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.
TextStyle(shadow) 추가해주시면 피그마와 디자인을 일치시킬 수 있습니다!