Skip to content

Commit 3f448f5

Browse files
committed
fix: delete button for menu photos
1 parent 0342295 commit 3f448f5

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

FoodieFootprints/Views/Components/MenuSection.swift

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,18 @@ struct MenuSection: View {
9898
.scaledToFill()
9999
.frame(width: 100, height: 100)
100100
.clipShape(RoundedRectangle(cornerRadius: 8))
101-
.overlay {
101+
.overlay(alignment: .topTrailing) {
102102
if isEditingMenu {
103-
deleteButton(for: menuFile)
103+
Button {
104+
menuFileToDelete = menuFile
105+
showingMenuDeleteConfirmation = true
106+
} label: {
107+
Image(systemName: "xmark.circle.fill")
108+
.foregroundStyle(.white)
109+
.background(Color.black.opacity(0.5))
110+
.clipShape(Circle())
111+
}
112+
.padding(4)
104113
}
105114
}
106115
.onTapGesture {
@@ -110,20 +119,6 @@ struct MenuSection: View {
110119
}
111120
}
112121

113-
private func deleteButton(for menuFile: MenuFile) -> some View {
114-
Button {
115-
menuFileToDelete = menuFile
116-
showingMenuDeleteConfirmation = true
117-
} label: {
118-
Image(systemName: "minus.circle.fill")
119-
.font(.title2)
120-
.foregroundStyle(.red)
121-
.background(Color.white)
122-
.clipShape(Circle())
123-
}
124-
.padding(4)
125-
}
126-
127122
private var photoViewerBinding: Binding<PhotoIdentifier?> {
128123
Binding(
129124
get: { selectedPhotoIndex.map { PhotoIdentifier(index: $0) } },
@@ -137,4 +132,4 @@ struct MenuSection: View {
137132
set: { selectedPhotoIndex = $0 }
138133
)
139134
}
140-
}
135+
}

0 commit comments

Comments
 (0)