Layout sidebar items differently on macOS and iOS due to rendering differences in the platforms

This commit is contained in:
Maurice Parker 2020-07-21 17:40:51 -05:00
parent 8d6d7b94cc
commit cf8c6f5e8e
1 changed files with 20 additions and 6 deletions

View File

@ -16,17 +16,31 @@ struct SidebarItemView: View {
var sidebarItem: SidebarItem
var body: some View {
HStack(alignment: .top) {
if let image = feedIconImageLoader.image {
IconImageView(iconImage: image)
.frame(width: 20, height: 20, alignment: .center)
HStack {
#if os(macOS)
HStack {
if let image = feedIconImageLoader.image {
IconImageView(iconImage: image)
.frame(width: 20, height: 20, alignment: .center)
}
Text(verbatim: sidebarItem.nameForDisplay)
Spacer()
if sidebarItem.unreadCount > 0 {
UnreadCountView(count: sidebarItem.unreadCount)
}
}
#else
HStack(alignment: .top) {
if let image = feedIconImageLoader.image {
IconImageView(iconImage: image)
.frame(width: 20, height: 20)
}
Text(verbatim: sidebarItem.nameForDisplay)
}
Text(verbatim: sidebarItem.nameForDisplay)
Spacer()
if sidebarItem.unreadCount > 0 {
UnreadCountView(count: sidebarItem.unreadCount)
}
#if os(iOS)
if sidebarItem.representedType == .webFeed || sidebarItem.representedType == .pseudoFeed {
Spacer()
.frame(width: 16)