show highlight annotation sheet when tapping on note or 'add a note'
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
import Models
|
||||
import SwiftUI
|
||||
import Views
|
||||
|
||||
struct HighlightsListCard: View {
|
||||
@State var isContextMenuOpen = false
|
||||
@State var annotation = String()
|
||||
@State var showAnnotationModal = false
|
||||
|
||||
let highlight: Highlight
|
||||
|
||||
@ -34,6 +37,10 @@ struct HighlightsListCard: View {
|
||||
|
||||
Text(highlight.annotation ?? "")
|
||||
}
|
||||
.onTapGesture {
|
||||
annotation = highlight.annotation ?? ""
|
||||
showAnnotationModal = true
|
||||
}
|
||||
}
|
||||
|
||||
var addNoteSection: some View {
|
||||
@ -48,7 +55,8 @@ struct HighlightsListCard: View {
|
||||
Spacer()
|
||||
}
|
||||
.onTapGesture {
|
||||
print("add a note")
|
||||
annotation = highlight.annotation ?? ""
|
||||
showAnnotationModal = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,5 +104,18 @@ struct HighlightsListCard: View {
|
||||
}
|
||||
.padding(.bottom, 8)
|
||||
}
|
||||
.sheet(isPresented: $showAnnotationModal) {
|
||||
HighlightAnnotationSheet(
|
||||
annotation: $annotation,
|
||||
onSave: {
|
||||
print("new annotation = \(annotation)")
|
||||
showAnnotationModal = false
|
||||
},
|
||||
onCancel: {
|
||||
print("cancel annotation")
|
||||
showAnnotationModal = false
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,15 +22,13 @@ public struct HighlightAnnotationSheet: View {
|
||||
HStack {
|
||||
Button("Cancel", action: onCancel)
|
||||
Spacer()
|
||||
HStack {
|
||||
Image(systemName: "note.text")
|
||||
Text("Note")
|
||||
}
|
||||
Label("Note", systemImage: "note.text")
|
||||
Spacer()
|
||||
Button("Save") {
|
||||
onSave()
|
||||
}
|
||||
}
|
||||
.foregroundColor(.appGrayTextContrast)
|
||||
|
||||
ScrollView {
|
||||
TextEditor(text: $annotation)
|
||||
|
||||
Reference in New Issue
Block a user