Skip to content

Commit 726bfc9

Browse files
committed
Apply PR review notes on PostCardYourNetwork. Remove unused parameter.
1 parent 8819a0f commit 726bfc9

File tree

2 files changed

+28
-34
lines changed

2 files changed

+28
-34
lines changed

JetNews/app/src/main/java/com/example/jetnews/ui/home/PostCardYourNetwork.kt

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -57,43 +57,38 @@ fun PostCardPopular(post: Post, modifier: Modifier = Modifier.None) {
5757
Container(modifier = LayoutHeight(100.dp) + LayoutSize.Fill) {
5858
DrawImage(image)
5959
}
60-
BottomSection(post)
60+
Column(modifier = LayoutPadding(16.dp)) {
61+
val emphasisLevels = EmphasisLevels()
62+
ProvideEmphasis(emphasis = emphasisLevels.high) {
63+
Text(
64+
text = post.title,
65+
style = MaterialTheme.typography().h6,
66+
maxLines = 2,
67+
overflow = TextOverflow.Ellipsis
68+
)
69+
}
70+
ProvideEmphasis(emphasis = emphasisLevels.high) {
71+
Text(
72+
text = post.metadata.author.name,
73+
maxLines = 1,
74+
overflow = TextOverflow.Ellipsis,
75+
style = MaterialTheme.typography().body2
76+
)
77+
}
78+
ProvideEmphasis(emphasis = emphasisLevels.high) {
79+
Text(
80+
text = "${post.metadata.date} - " +
81+
"${post.metadata.readTimeMinutes} min read",
82+
style = MaterialTheme.typography().body2
83+
)
84+
}
85+
}
6186
}
6287
}
6388
}
6489
}
6590
}
6691

67-
@Composable
68-
private fun BottomSection(post: Post) {
69-
Column(modifier = LayoutPadding(16.dp)) {
70-
val emphasisLevels = EmphasisLevels()
71-
ProvideEmphasis(emphasis = emphasisLevels.high) {
72-
Text(
73-
text = post.title,
74-
style = MaterialTheme.typography().h6,
75-
maxLines = 2,
76-
overflow = TextOverflow.Ellipsis
77-
)
78-
}
79-
ProvideEmphasis(emphasis = emphasisLevels.high) {
80-
Text(
81-
text = post.metadata.author.name,
82-
maxLines = 1,
83-
overflow = TextOverflow.Ellipsis,
84-
style = MaterialTheme.typography().body2
85-
)
86-
}
87-
ProvideEmphasis(emphasis = emphasisLevels.high) {
88-
Text(
89-
text = "${post.metadata.date} - " +
90-
"${post.metadata.readTimeMinutes} min read",
91-
style = MaterialTheme.typography().body2
92-
)
93-
}
94-
}
95-
}
96-
9792

9893
@Preview
9994
@Composable
@@ -103,7 +98,7 @@ fun PreviewPostCardPopular() {
10398

10499
@Preview
105100
@Composable
106-
fun PreviewBottomSectionLongText() {
101+
fun PreviewPostCardPopularLongText() {
107102

108103
val loremIpsum = """
109104
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ullamcorper pharetra massa,
@@ -114,7 +109,7 @@ fun PreviewBottomSectionLongText() {
114109
consectetur dolor. Proin lobortis venenatis sem, in vestibulum est. Duis ac nibh interdum,
115110
""".trimIndent()
116111
val post = post1
117-
BottomSection(post = post.copy(
112+
PostCardPopular(post = post.copy(
118113
title = "Title" + loremIpsum,
119114
metadata = post.metadata.copy(
120115
author = PostAuthor("Author: " + loremIpsum),

JetNews/app/src/main/java/com/example/jetnews/ui/interests/SelectTopicButton.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import com.example.jetnews.ui.lightThemeColors
3737
@Composable
3838
fun SelectTopicButton(
3939
modifier: Modifier = Modifier.None,
40-
onSelected: ((Boolean) -> Unit)? = null,
4140
selected: Boolean = false
4241
) {
4342
Container(modifier = modifier + LayoutSize(36.dp, 36.dp)) {

0 commit comments

Comments
 (0)