aboutsummaryrefslogtreecommitdiff
path: root/iGopherBrowser/SidebarView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'iGopherBrowser/SidebarView.swift')
-rw-r--r--iGopherBrowser/SidebarView.swift23
1 files changed, 23 insertions, 0 deletions
diff --git a/iGopherBrowser/SidebarView.swift b/iGopherBrowser/SidebarView.swift
new file mode 100644
index 0000000..61c1360
--- /dev/null
+++ b/iGopherBrowser/SidebarView.swift
@@ -0,0 +1,23 @@
+//
+// SidebarView.swift
+// iGopherBrowser
+//
+// Created by Navan Chauhan on 12/13/23.
+//
+
+import Foundation
+import SwiftUI
+
+struct SidebarView: View {
+ let hosts: [GopherNode]
+ var onSelect: (GopherNode) -> Void
+
+ var body: some View {
+ List(hosts, children: \.children) { node in
+ Text(node.message ?? node.host)
+ .onTapGesture {
+ onSelect(node)
+ }
+ }
+ }
+}