common: extract PostDetails composable for comments

This commit is contained in:
Harsh Shandilya 2021-10-04 17:26:54 +05:30
parent 5b2b7de7d0
commit 84fd9a2c61
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -55,16 +55,8 @@ fun LobstersCard(
modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp).fillMaxWidth(), modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp).fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(4.dp), verticalArrangement = Arrangement.spacedBy(4.dp),
) { ) {
PostTitle( PostDetails(
title = post.title, post = post,
)
TagRow(
tags = post.tags,
)
SubmitterName(
text = "Submitted by ${post.submitterName}",
avatarUrl = "https://lobste.rs/${post.submitterAvatarUrl}",
contentDescription = "Submitted by ${post.submitterName}",
) )
Row( Row(
modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp), modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp),
@ -86,6 +78,23 @@ fun LobstersCard(
} }
} }
@Composable
fun PostDetails(
post: SavedPost,
) {
PostTitle(
title = post.title,
)
TagRow(
tags = post.tags,
)
SubmitterName(
text = "Submitted by ${post.submitterName}",
avatarUrl = "https://lobste.rs/${post.submitterAvatarUrl}",
contentDescription = "Submitted by ${post.submitterName}",
)
}
@Composable @Composable
fun PostTitle( fun PostTitle(
title: String, title: String,