sort highlights by createdAt
This commit is contained in:
@ -37,7 +37,19 @@ struct HighlightsListCard: View {
|
||||
}
|
||||
|
||||
var addNoteSection: some View {
|
||||
Text("Tap to add a note")
|
||||
HStack {
|
||||
Image(systemName: "note.text.badge.plus").foregroundColor(.appGrayTextContrast)
|
||||
|
||||
Text("Add a Note")
|
||||
.font(.appSubheadline)
|
||||
.foregroundColor(.appGrayTextContrast)
|
||||
.lineLimit(1)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.onTapGesture {
|
||||
print("add a note")
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
|
||||
@ -8,7 +8,11 @@ import Views
|
||||
@Published var highlights = [Highlight]()
|
||||
|
||||
func load(item: LinkedItem) {
|
||||
highlights = item.highlights.asArray(of: Highlight.self)
|
||||
let unsortedHighlights = item.highlights.asArray(of: Highlight.self)
|
||||
|
||||
highlights = unsortedHighlights.sorted {
|
||||
($0.createdAt ?? Date()) < ($1.createdAt ?? Date())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user