mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-05-17 05:07:11 +02:00
feat: update memo favorite button
This commit is contained in:
@@ -8,7 +8,6 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct MemosView: View {
|
struct MemosView: View {
|
||||||
@Environment(\.colorScheme) var colorScheme
|
|
||||||
@Environment(\.horizontalSizeClass) var horizontalSizeClass
|
@Environment(\.horizontalSizeClass) var horizontalSizeClass
|
||||||
|
|
||||||
@FetchRequest var memoObjects: FetchedResults<MemoObject>
|
@FetchRequest var memoObjects: FetchedResults<MemoObject>
|
||||||
@@ -171,16 +170,17 @@ struct MemosView: View {
|
|||||||
}
|
}
|
||||||
.overlay(alignment: .topTrailing) {
|
.overlay(alignment: .topTrailing) {
|
||||||
Image(systemName: memoObject.isFavorite ? "star.fill" : "star")
|
Image(systemName: memoObject.isFavorite ? "star.fill" : "star")
|
||||||
.foregroundStyle(memoObject.isFavorite ? .yellow : .white)
|
.contentTransition(.symbolEffect(.replace))
|
||||||
|
.foregroundStyle(memoObject.isFavorite ? .yellow : .primary)
|
||||||
|
.animation(.easeInOut, value: memoObject.isFavorite)
|
||||||
.frame(width: 20, height: 20)
|
.frame(width: 20, height: 20)
|
||||||
.padding(5)
|
.padding(5)
|
||||||
.background(.black.opacity(0.5))
|
.background(.gray)
|
||||||
.cornerRadius(5)
|
.cornerRadius(5)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
toggleFavorite(for: memoObject)
|
toggleFavorite(for: memoObject)
|
||||||
}
|
}
|
||||||
.contentTransition(.symbolEffect(.replace))
|
|
||||||
.padding(5)
|
.padding(5)
|
||||||
}
|
}
|
||||||
VStack(alignment: .leading, spacing: 2) {
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user