NetNewsWire/Multiplatform/Shared/Sidebar/SidebarItemView.swift
2020-06-29 20:09:11 -05:00

36 lines
707 B
Swift

//
// SidebarItemView.swift
// NetNewsWire
//
// Created by Maurice Parker on 6/29/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import SwiftUI
import Account
struct SidebarItemView: View {
@StateObject var feedImageLoader = FeedImageLoader()
var sidebarItem: SidebarItem
var body: some View {
HStack {
if let image = feedImageLoader.image {
IconImageView(iconImage: image)
}
Text(verbatim: sidebarItem.nameForDisplay)
Spacer()
if sidebarItem.unreadCount > 0 {
UnreadCountView(count: sidebarItem.unreadCount)
}
}
.onAppear {
if let feed = sidebarItem.represented as? Feed {
feedImageLoader.loadImage(for: feed)
}
}
}
}