Skip to content

Commit

Permalink
add action for core ui for trip planner
Browse files Browse the repository at this point in the history
  • Loading branch information
hilmyveradin committed Jun 27, 2024
1 parent 12e3031 commit a18fd11
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,29 @@ struct OriginDestinationSheetView: View {
TextField("Search for a restaurant", text: $search)
.autocorrectionDisabled()
}
.padding([.top, .bottom], 8)
.padding([.leading, .trailing], 12)
.padding(.vertical, 8)
.padding(.horizontal, 12)
.background(Color.gray.opacity(0.2))
.clipShape(.rect(cornerRadius: 12))
.padding([.leading, .trailing], 16)
.padding(.horizontal, 16)

Spacer()

List {
ForEach(locationService.completions) { completion in
Button(action: {}, label: {
VStack(alignment: .leading, spacing: 4) {
Text(completion.title)
.font(.headline)
Text(completion.subTitle)
Button(action: {
sheetEnvironment.selectedValue = completion.title
dismiss()
}, label: {
HStack {
VStack(alignment: .leading, spacing: 4) {
Text(completion.title)
.font(.headline)
Text(completion.subTitle)
}
Spacer()
Image(systemName: "chevron.right")
.foregroundColor(.gray)
}
})
// 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ enum OriginDestinationSheetState {

final class OriginDestinationSheetEnvironment: ObservableObject {
@Published var sheetState: OriginDestinationSheetState = .origin
@Published var selectedValue: String = ""
}

0 comments on commit a18fd11

Please sign in to comment.