Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- 제목:
N주차 미션 / N조 000 (확인 후 지워주세요)

## 1. 미션
각 주차에 해당하는 미션 체크리스트

-

## 2. 구현에 대한 설명
본인이 구현한 것에 대한 설명

-

## 3. 스크린샷 & 실행영상
실행영상이 있다면 실행영상을, 없다면 스크린샷 첨부

-

## 4. 기타
기타 문의사항이나 질문사항, 그 외 하고싶은 말

-
40 changes: 40 additions & 0 deletions app/src/main/java/com/example/kuit7/components/Filter.kt
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(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

TextStyle(shadow) 추가해주시면 피그마와 디자인을 일치시킬 수 있습니다!

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()
}
28 changes: 28 additions & 0 deletions app/src/main/java/com/example/kuit7/components/Label.kt
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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if 를 사용해서 color 속성을 바꿔주면 피그마 디자인과 일치시킬 수 있습니다!
예) color = if (index == 0) Color.Black else ...

}
}
}

@Preview
@Composable
private fun PreviewLazyRow() {
Label()
}
84 changes: 84 additions & 0 deletions app/src/main/java/com/example/kuit7/components/News.kt
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(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

긴 텍스트에 대응하기 위해 maxLines/overflow 처리가 필요해 보입니다!
예) maxLines = 2, overflow = TextOverflow.Ellipsis

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()
}
35 changes: 35 additions & 0 deletions app/src/main/java/com/example/kuit7/components/Title.kt
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()
}
15 changes: 15 additions & 0 deletions app/src/main/java/com/example/kuit7/data/LabelItem.kt
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"
)
}
75 changes: 75 additions & 0 deletions app/src/main/java/com/example/kuit7/data/NewsItem.kt
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,
)
)
}
32 changes: 32 additions & 0 deletions app/src/main/java/com/example/kuit7/ui/Week02.kt
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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

상하좌우에 패딩이 들어가서, 하단에는 패딩이 적용 안되도록 수정하는 게 좋을 것 같습니다!
예) .padding(start = 24.dp, top = 24.dp, end = 24.dp)

){
Column(
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Title()
Filter()
Label()
News()
}
}
}

@Preview
@Composable
private fun PreviewWeek02() {
Week02()
}
Binary file added app/src/main/res/drawable/news1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/news2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/news3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/news4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/news5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.