diff LazyBear/Views/Profile/Helpers/WatchlistCreatorSearchBar.swift @ 393:0a4c399170c4

Implementing WatchlistCreator
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sun, 02 May 2021 12:41:20 +0200
parents
children 5f21f7c23c5e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LazyBear/Views/Profile/Helpers/WatchlistCreatorSearchBar.swift	Sun May 02 12:41:20 2021 +0200
@@ -0,0 +1,40 @@
+//
+//  WatchlistCreatorSearchBar.swift
+//  LazyBear
+//
+//  Created by Dennis Concepción Martín on 2/5/21.
+//
+
+import SwiftUI
+import Introspect
+
+struct WatchlistCreatorSearchBar: View {
+    @Binding var searchedCompany: String
+    
+    var body: some View {
+        TextField("", text: $searchedCompany)
+        .introspectTextField { textField in
+            textField.becomeFirstResponder()
+        }
+            .padding(10)
+            .padding(.leading, 40)
+            .overlay(
+                Image(systemName: "magnifyingglass")
+                    .imageScale(.large)
+                    .opacity(0.4)
+                    .padding(.horizontal)
+                ,alignment: .leading
+            )
+            .background(
+                Color(.secondarySystemBackground)
+                    .cornerRadius(10)
+            )
+            .padding()
+    }
+}
+
+struct CustomSearchBar_Previews: PreviewProvider {
+    static var previews: some View {
+        WatchlistCreatorSearchBar(searchedCompany: .constant(""))
+    }
+}