-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from LucasJorgeHubert/feature/location-search
Feature - Location Search inputs and list
- Loading branch information
Showing
8 changed files
with
275 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// HomeView.swift | ||
// MarvelUI | ||
// | ||
// Created by Lucas Hubert on 17/05/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct HomeView: View { | ||
@State private var showLocationSearchView = false | ||
var body: some View { | ||
ZStack(alignment: .top) { | ||
UberMapViewRepresentable() | ||
.ignoresSafeArea() | ||
|
||
if showLocationSearchView { | ||
LocationSeachView() | ||
} else { | ||
LocationSearchActivationView() | ||
.padding(.vertical, 72) | ||
.onTapGesture { | ||
withAnimation(.spring()) { | ||
showLocationSearchView.toggle() | ||
} | ||
} | ||
} | ||
|
||
MapViewActionButton(showLocationSearchView: $showLocationSearchView) | ||
.padding(.leading) | ||
.padding(.top, 4) | ||
} | ||
} | ||
} | ||
|
||
struct HomeView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
HomeView() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// MapViewActionButton.swift | ||
// MarvelUI | ||
// | ||
// Created by Lucas Hubert on 17/05/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct MapViewActionButton: View { | ||
@Binding var showLocationSearchView: Bool | ||
|
||
var body: some View { | ||
Button { | ||
withAnimation(.spring()) { | ||
showLocationSearchView.toggle() | ||
} | ||
} label: { | ||
Image( | ||
systemName: showLocationSearchView | ||
? "arrow.left" | ||
: "line.3.horizontal" | ||
) | ||
.font(.title2) | ||
.foregroundColor(.black) | ||
.padding() | ||
.background(.white) | ||
.clipShape(Circle()) | ||
.shadow(radius: 6) | ||
} | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
} | ||
} | ||
|
||
struct MapViewActionButton_Previews: PreviewProvider { | ||
static var previews: some View { | ||
MapViewActionButton(showLocationSearchView: .constant(true)) | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// LocationSeachView.swift | ||
// MarvelUI | ||
// | ||
// Created by Lucas Hubert on 17/05/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct LocationSeachView: View { | ||
@State private var startLocationText = "" | ||
@State private var destinationLocationText = "" | ||
|
||
var body: some View { | ||
VStack { | ||
HStack { | ||
VStack { | ||
Circle() | ||
.fill(Color(.systemGray3)) | ||
.frame(width: 6, height: 6) | ||
|
||
Rectangle() | ||
.fill(Color(.systemGray3)) | ||
.frame(width: 1, height: 24) | ||
|
||
Rectangle() | ||
.fill(Color.black) | ||
.frame(width: 6, height: 6) | ||
} | ||
|
||
VStack { | ||
TextField("Current Location", text: | ||
$startLocationText | ||
) | ||
.frame(height: 32) | ||
.background(Color(.systemGroupedBackground)) | ||
.padding(.trailing) | ||
|
||
TextField("Where to?", text: | ||
$startLocationText | ||
) | ||
.frame(height: 32) | ||
.background(Color(.systemGray4)) | ||
.padding(.trailing) | ||
} | ||
} | ||
.padding(.horizontal) | ||
.padding(.top, 64) | ||
|
||
Divider() | ||
.padding(.vertical) | ||
|
||
ScrollView { | ||
VStack(alignment: .leading) { | ||
ForEach(0 ..< 20, id: \.self) { _ in | ||
LocationSearchResultCell() | ||
} | ||
} | ||
} | ||
} | ||
.background(.white) | ||
.opacity(0.9) | ||
} | ||
} | ||
|
||
struct LocationSeachView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
LocationSeachView() | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
MarvelUI/Core/LocationSearch/View/LocationSearchActivationView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// LocationSearchActivationView.swift | ||
// MarvelUI | ||
// | ||
// Created by Lucas Hubert on 17/05/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct LocationSearchActivationView: View { | ||
var body: some View { | ||
HStack { | ||
Rectangle() | ||
.fill(Color.black) | ||
.frame(width: 8, height: 8) | ||
.padding(.horizontal) | ||
|
||
Text("Where to?") | ||
.foregroundColor(Color(.darkGray)) | ||
|
||
Spacer() | ||
} | ||
.frame(width: UIScreen.main.bounds.width - 64, height: 50) | ||
.background( | ||
Rectangle() | ||
.fill(Color.white) | ||
.shadow(color: .black, radius: 6) | ||
) | ||
} | ||
} | ||
|
||
struct LocationSearchActivationView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
LocationSearchActivationView() | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
MarvelUI/Core/LocationSearch/View/LocationSearchResultCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// LocationSearchResultCell.swift | ||
// MarvelUI | ||
// | ||
// Created by Lucas Hubert on 17/05/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct LocationSearchResultCell: View { | ||
var body: some View { | ||
HStack { | ||
Image(systemName: "mappin.circle.fill") | ||
.resizable() | ||
.foregroundColor(.blue) | ||
.accentColor(.white) | ||
.frame(width: 40, height: 40) | ||
|
||
VStack(alignment: .leading) { | ||
Text("Starbucks Coffee") | ||
.font(.body) | ||
|
||
Text("123 Main ST, Cupertino CA") | ||
.font(.system(size: 15)) | ||
.foregroundColor(.gray) | ||
|
||
Divider() | ||
} | ||
.padding(.leading, 8) | ||
.padding(.vertical, 8) | ||
} | ||
.padding(.leading) | ||
} | ||
} | ||
|
||
struct LocationSearchResultCell_Previews: PreviewProvider { | ||
static var previews: some View { | ||
LocationSearchResultCell() | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.