@@ -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),
0 commit comments