Skip to content

Commit

Permalink
Update title view to combine title and sort button into a single drop…
Browse files Browse the repository at this point in the history
… down
  • Loading branch information
atrinh0 committed Nov 5, 2022
1 parent f3a29bf commit dcaeda2
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions covid19/covid19/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ struct ContentView: View {
ScrollView {
chartAndDataView
}
.navigationTitle(Text(locationSelection.rawValue))
.navigationBarTitleDisplayMode(.inline)
.navigationBarItems(trailing: sortButton)
.toolbar {
ToolbarItem(placement: .principal) {
sortButton
}
}
.refreshable {
reloadDataAndWidget()
}
Expand Down Expand Up @@ -154,13 +157,21 @@ struct ContentView: View {
}
} label: { Text("Location") }
} label: {
Image(systemName: "chevron.down.circle.fill")
.font(Font.title2.bold())
.accessibilityLabel(Text("Select nation"))
HStack {
Text(locationSelection.rawValue)
.font(.headline)
.fontWeight(.semibold)
Image(systemName: "chevron.down.circle.fill")
.font(.callout.bold())
.accessibilityLabel(Text("Select nation"))
.foregroundStyle(Color.accentColor)
}
}
.onChange(of: locationSelection) { _ in
reloadData()
}
.animation(.none, value: locationSelection)
.foregroundStyle(.primary)
}
}

Expand Down

0 comments on commit dcaeda2

Please sign in to comment.