Added date and byline to timeline

This commit is contained in:
Maurice Parker 2020-07-01 17:39:27 -05:00
parent bacffbadbe
commit 0b36498ff8
2 changed files with 25 additions and 2 deletions

View File

@ -33,4 +33,12 @@ struct TimelineItem: Identifiable {
return .showNone
}
var byline: String {
return article.byline()
}
var dateTimeString: String {
return ArticleStringFormatter.dateString(article.logicalDatePublished)
}
}

View File

@ -21,8 +21,23 @@ struct TimelineItemView: View {
IconImageView(iconImage: image)
.frame(width: AppDefaults.timelineIconSize.size.width, height: AppDefaults.timelineIconSize.size.height, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
}
Text(verbatim: timelineItem.article.title ?? "N/A")
.frame(maxWidth: .infinity, alignment: .leading)
VStack {
Text(verbatim: timelineItem.article.title ?? "N/A")
.lineLimit(3)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.trailing, 4)
Spacer()
HStack {
Text(verbatim: timelineItem.byline)
.font(.footnote)
.foregroundColor(.secondary)
Spacer()
Text(verbatim: timelineItem.dateTimeString)
.font(.footnote)
.foregroundColor(.secondary)
.padding(.trailing, 4)
}
}
}
Divider()
}