mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Refactor sidebar styling to remove duplicate code
This commit is contained in:
34
Multiplatform/Shared/Sidebar/SidebarStyleModifier.swift
Normal file
34
Multiplatform/Shared/Sidebar/SidebarStyleModifier.swift
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// SidebarStyleModifier.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Maurice Parker on 7/6/20.
|
||||
// Copyright © 2020 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SidebarListStyleModifier: ViewModifier {
|
||||
|
||||
#if os(iOS)
|
||||
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
||||
#endif
|
||||
|
||||
@ViewBuilder func body(content: Content) -> some View {
|
||||
content
|
||||
#if os(macOS)
|
||||
content
|
||||
.listStyle(SidebarListStyle())
|
||||
#else
|
||||
if horizontalSizeClass == .compact {
|
||||
content
|
||||
.listStyle(PlainListStyle())
|
||||
} else {
|
||||
content
|
||||
.listStyle(SidebarListStyle())
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user