mirror of
https://github.com/yattee/yattee.git
synced 2026-02-20 01:39:46 +00:00
Yattee v2 rewrite
This commit is contained in:
49
Yattee/Views/RemoteControl/RemoteDevicesSheet.swift
Normal file
49
Yattee/Views/RemoteControl/RemoteDevicesSheet.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// RemoteDevicesSheet.swift
|
||||
// Yattee
|
||||
//
|
||||
// Sheet for quickly accessing remote control devices from Home.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RemoteDevicesSheet: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
@State private var selectedDevice: DiscoveredDevice?
|
||||
|
||||
var body: some View {
|
||||
DynamicSheetContainer {
|
||||
NavigationStack {
|
||||
RemoteControlContentView(navigationStyle: .selection($selectedDevice))
|
||||
.navigationTitle("Remote Control")
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
#endif
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 400, minHeight: 300)
|
||||
#endif
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button(role: .cancel) {
|
||||
dismiss()
|
||||
} label: {
|
||||
Label("Close", systemImage: "xmark")
|
||||
.labelStyle(.iconOnly)
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationDestination(item: $selectedDevice) { device in
|
||||
RemoteControlView(device: device)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Preview
|
||||
|
||||
#Preview {
|
||||
RemoteDevicesSheet()
|
||||
.appEnvironment(.preview)
|
||||
}
|
||||
Reference in New Issue
Block a user