Cards are now in a stack

This commit is contained in:
Avery Pace
2021-11-07 01:25:18 -05:00
parent 32456552a1
commit 76a6232d71
5 changed files with 125 additions and 102 deletions

View File

@@ -15,10 +15,33 @@ extension String: Identifiable {
struct ContentView: View {
@Environment(\.managedObjectContext) private var viewContext
@State private var tokiInput: String = ""
var body: some View {
TabView {
TranslatorView()
.tabItem {
Image(systemName: "pencil")
Text("Phrase Lookup")
}
FlashCardView()
.tabItem {
Image(systemName: "character.textbox")
Text("Flash Cards")
}
}
}
func openPartsOfSpeechView() {
print("Button pressed.")
}
}
struct TranslatorView: View {
@ObservedObject var tokiDictViewModel = TokiDictionaryViewModel()
@State private var selectedPartOfSpeech: String?
@State private var tokiInput: String = ""
var body: some View {
VStack {
TextField("Enter Toki Pona Word or Phrase", text: $tokiInput)
@@ -53,25 +76,11 @@ struct ContentView: View {
}
}
}
.safeAreaInset(edge: .bottom) {
HStack() {
Button("Parts of Speech") {
self.selectedPartOfSpeech = ""
}
.padding(8)
}
.frame(maxWidth: .infinity)
.background(.thinMaterial)
}
.sheet(item: $selectedPartOfSpeech) { selectedPOS in
PartsOfSpeechView(selectedPartOfSpeech: selectedPOS, partsOfSpeech: tokiDictViewModel.partsOfSpeech)
}
}
}
func openPartsOfSpeechView() {
print("Button pressed.")
}
}