Make selected indicator white

This commit is contained in:
Maurice Parker 2020-07-19 18:20:05 -05:00
parent 4446fa0ca9
commit 29386d74d6
4 changed files with 20 additions and 6 deletions

View File

@ -268,6 +268,10 @@ struct AppAssets {
#endif
}
static var timelineUnreadSelected: Image {
return Image(systemName: "circle.fill")
}
static var todayFeedImage: IconImage = {
#if os(macOS)
let image = NSImage(systemSymbolName: "sun.max.fill", accessibilityDescription: nil)!

View File

@ -10,6 +10,7 @@ import SwiftUI
struct TimelineItemStatusView: View {
var selected: Bool
var status: TimelineItemStatus
@ViewBuilder var statusView: some View {
@ -17,10 +18,17 @@ struct TimelineItemStatusView: View {
Spacer().frame(width: 12)
switch status {
case .showUnread:
AppAssets.timelineUnread
.resizable()
.frame(width: 8, height: 8, alignment: .center)
.padding(.all, 2)
if selected {
AppAssets.timelineUnreadSelected
.resizable()
.frame(width: 8, height: 8, alignment: .center)
.padding(.all, 2)
} else {
AppAssets.timelineUnread
.resizable()
.frame(width: 8, height: 8, alignment: .center)
.padding(.all, 2)
}
case .showStar:
AppAssets.timelineStarred
.resizable()

View File

@ -13,6 +13,7 @@ struct TimelineItemView: View {
@EnvironmentObject var defaults: AppDefaults
@StateObject var articleIconImageLoader = ArticleIconImageLoader()
var selected: Bool
var width: CGFloat
var timelineItem: TimelineItem
@ -25,7 +26,7 @@ struct TimelineItemView: View {
var body: some View {
HStack(alignment: .top) {
TimelineItemStatusView(status: timelineItem.status)
TimelineItemStatusView(selected: selected, status: timelineItem.status)
if let image = articleIconImageLoader.image {
IconImageView(iconImage: image)
.frame(width: CGFloat(defaults.timelineIconDimensions), height: CGFloat(defaults.timelineIconDimensions), alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)

View File

@ -41,7 +41,8 @@ struct TimelineView: View {
EmptyView()
}.hidden()
List(timelineModel.timelineItems, selection: $timelineModel.selectedArticleIDs) { timelineItem in
TimelineItemView(width: proxy.size.width, timelineItem: timelineItem)
let selected = timelineModel.selectedArticleIDs.contains(timelineItem.article.articleID)
TimelineItemView(selected: selected, width: proxy.size.width, timelineItem: timelineItem)
}
}
}