diff options
Diffstat (limited to 'Sora/Views')
| -rw-r--r-- | Sora/Views/Post/Details/PostDetailsTagsView.swift | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Sora/Views/Post/Details/PostDetailsTagsView.swift b/Sora/Views/Post/Details/PostDetailsTagsView.swift index 94f9f69..452906a 100644 --- a/Sora/Views/Post/Details/PostDetailsTagsView.swift +++ b/Sora/Views/Post/Details/PostDetailsTagsView.swift @@ -10,15 +10,29 @@ struct PostDetailsTagsView: View { ForEach(tags, id: \.self) { tag in Button(action: { manager.searchText = tag - manager.selectedPost = nil - manager.performSearch() - isPresented.toggle() + + search() }) { Text(tag) } + .contextMenu { + Button(action: { + manager.searchText += " \(tag)" + + search() + }) { + Label("Add to current search query", systemImage: "plus") + } + } } } } + + private func search() { + manager.selectedPost = nil + manager.performSearch() + isPresented.toggle() + } } #Preview { |