mirror of
https://github.com/lil-org/tokenary.git
synced 2024-12-02 09:33:49 +03:00
add networks list view
This commit is contained in:
parent
ebf82801e7
commit
29ae4edbb7
49
Shared/Views/NetworksListView.swift
Normal file
49
Shared/Views/NetworksListView.swift
Normal file
@ -0,0 +1,49 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct NetworksListView: View {
|
||||
@State private var searchText: String = ""
|
||||
let items: [String] = (1...30).map { String($0) }
|
||||
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
|
||||
var filteredItems: [String] {
|
||||
items.filter { $0.contains(searchText) || searchText.isEmpty }
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
SearchBar(text: $searchText)
|
||||
List(filteredItems, id: \.self) { item in
|
||||
Text(item)
|
||||
}
|
||||
|
||||
Divider() // Separate the list from the buttons
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Cancel") {
|
||||
self.presentationMode.wrappedValue.dismiss()
|
||||
}
|
||||
.padding()
|
||||
|
||||
Button("OK") {
|
||||
self.presentationMode.wrappedValue.dismiss()
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct SearchBar: View {
|
||||
@Binding var text: String
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
TextField("Search ...", text: $text)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
}.padding()
|
||||
}
|
||||
}
|
@ -140,8 +140,8 @@
|
||||
2C96D3A62763CCA000687301 /* Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C96D3A52763CCA000687301 /* Images.swift */; };
|
||||
2C96D3A92763D13400687301 /* DataStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C96D3A72763D13400687301 /* DataStateView.swift */; };
|
||||
2C96D3AA2763D13400687301 /* DataStateView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2C96D3A82763D13400687301 /* DataStateView.xib */; };
|
||||
2C9931DC2AEEC0E200577C8A /* EthereumNetworksList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9931DB2AEEC0E200577C8A /* EthereumNetworksList.swift */; };
|
||||
2C9931DD2AEEC0E200577C8A /* EthereumNetworksList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9931DB2AEEC0E200577C8A /* EthereumNetworksList.swift */; };
|
||||
2C9931DC2AEEC0E200577C8A /* NetworksListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9931DB2AEEC0E200577C8A /* NetworksListView.swift */; };
|
||||
2C9931DD2AEEC0E200577C8A /* NetworksListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9931DB2AEEC0E200577C8A /* NetworksListView.swift */; };
|
||||
2C9F0B6826BDCB2E008FA3D6 /* EthereumNetwork.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9F0B6726BDCB2E008FA3D6 /* EthereumNetwork.swift */; };
|
||||
2CAA412526C7CD93009F3535 /* ReviewRequester.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CAA412426C7CD93009F3535 /* ReviewRequester.swift */; };
|
||||
2CB3845A27654EA900A189B9 /* _locales in Resources */ = {isa = PBXBuildFile; fileRef = 2CB3845827654E9700A189B9 /* _locales */; };
|
||||
@ -366,7 +366,7 @@
|
||||
2C96D3A52763CCA000687301 /* Images.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Images.swift; sourceTree = "<group>"; };
|
||||
2C96D3A72763D13400687301 /* DataStateView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataStateView.swift; sourceTree = "<group>"; };
|
||||
2C96D3A82763D13400687301 /* DataStateView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DataStateView.xib; sourceTree = "<group>"; };
|
||||
2C9931DB2AEEC0E200577C8A /* EthereumNetworksList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthereumNetworksList.swift; sourceTree = "<group>"; };
|
||||
2C9931DB2AEEC0E200577C8A /* NetworksListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworksListView.swift; sourceTree = "<group>"; };
|
||||
2C9F0B6726BDCB2E008FA3D6 /* EthereumNetwork.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthereumNetwork.swift; sourceTree = "<group>"; };
|
||||
2CAA412426C7CD93009F3535 /* ReviewRequester.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewRequester.swift; sourceTree = "<group>"; };
|
||||
2CB3844327654BF600A189B9 /* error.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = error.js; path = "web3-provider/error.js"; sourceTree = "<group>"; };
|
||||
@ -850,7 +850,7 @@
|
||||
2CED86B12AF01DFD006F9E26 /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2C9931DB2AEEC0E200577C8A /* EthereumNetworksList.swift */,
|
||||
2C9931DB2AEEC0E200577C8A /* NetworksListView.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
@ -1358,7 +1358,7 @@
|
||||
2C264BEB27B6B50700234393 /* DappRequestProcessor.swift in Sources */,
|
||||
2CE3D012267F73C00032A62E /* Transaction.swift in Sources */,
|
||||
2C90E62227B2ED2D00C8991E /* SafariRequest+Helpers.swift in Sources */,
|
||||
2C9931DC2AEEC0E200577C8A /* EthereumNetworksList.swift in Sources */,
|
||||
2C9931DC2AEEC0E200577C8A /* NetworksListView.swift in Sources */,
|
||||
2C09FC662828331D00DE9C27 /* Image.swift in Sources */,
|
||||
2C73215A2AEE8F5200AA8A71 /* ConfigurationService.swift in Sources */,
|
||||
2C8A09EB2675964700993638 /* ApproveViewController.swift in Sources */,
|
||||
@ -1379,7 +1379,7 @@
|
||||
2CF255BA275A749300AE54B9 /* ApproveViewController.swift in Sources */,
|
||||
2C3024FD28C1193100C304ED /* TokenaryAccount.swift in Sources */,
|
||||
2C96D3962762380400687301 /* ButtonWithExtendedArea.swift in Sources */,
|
||||
2C9931DD2AEEC0E200577C8A /* EthereumNetworksList.swift in Sources */,
|
||||
2C9931DD2AEEC0E200577C8A /* NetworksListView.swift in Sources */,
|
||||
2C264BC227B2F2C100234393 /* EthereumSafariRequest.swift in Sources */,
|
||||
2CE059372763D60A0042D844 /* KeyboardObserver.swift in Sources */,
|
||||
2CF255A0275A47DD00AE54B9 /* Bundle.swift in Sources */,
|
||||
|
Loading…
Reference in New Issue
Block a user