Die Suche laeuft flottenweit ueber den nativen Such-Tab (Tab role: .search) + ManaSearchResultsView statt ueber das Custom-Such-Icon in der Filter-Leiste. Letzter Konsument (seepuls VenueListView) ist entfernt; @available(*, deprecated) markiert, CHANGELOG gepflegt. Playbook: ../mana/docs/playbooks/SEARCH_TAB_ROLLOUT.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
70 lines
2.8 KiB
Swift
70 lines
2.8 KiB
Swift
import ManaTokens
|
||
import SwiftUI
|
||
|
||
/// Rundes Such-Icon für die Bottom-Filter-Leiste — Einstieg in die
|
||
/// *native* Suche (`.searchable(text:isPresented:)`). Gedacht als fester
|
||
/// Anker **rechts** in einer Filter-Leiste (außerhalb des horizontalen
|
||
/// Pill-Scrollers), Platzierung wie die System-Suche in der Apple-
|
||
/// Podcasts-App. Referenz-Adoption: seepuls-Events/Orte-Tab.
|
||
///
|
||
/// Form & Größe sind hier zentral festgelegt (46×46, `.circle`), damit das
|
||
/// Icon über die Flotte gleich aussieht. Farbe kommt aus der aktiven
|
||
/// Theme-Variant via `@Environment(\.manaTheme)` — keine Farb-Parameter,
|
||
/// analog zu ``ManaPill``.
|
||
///
|
||
/// **iOS 26:** echtes Liquid-Glass (`glassEffect`). **iOS 18–25:**
|
||
/// Material-Kreis mit Hairline — konsistent mit den Filter-Leisten-Gläsern.
|
||
///
|
||
/// ```swift
|
||
/// // In der Filter-Leiste, rechts neben dem Pill-Scroller:
|
||
/// HStack {
|
||
/// ScrollView(.horizontal) { /* Filter-Pills */ }
|
||
/// ManaSearchButton { searchPresented = true }
|
||
/// }
|
||
/// // dazu am Screen: .searchable(text: $q, isPresented: $searchPresented)
|
||
/// ```
|
||
///
|
||
/// > **Deprecated (2026-06-06):** Die Suche läuft flottenweit über den nativen
|
||
/// > Such-Tab (`Tab(role: .search)`) statt über ein Custom-Such-Icon in der
|
||
/// > Filter-Leiste. Siehe ``ManaSearchResultsView`` +
|
||
/// > `../mana/docs/playbooks/SEARCH_TAB_ROLLOUT.md`. Keine Konsumenten mehr;
|
||
/// > bleibt für Übergangs-Fälle, soll aber nicht neu adoptiert werden.
|
||
@available(*, deprecated, message: "Nutze den nativen Such-Tab (Tab(role: .search)) + ManaSearchResultsView statt eines Custom-Such-Icons. Siehe SEARCH_TAB_ROLLOUT.md.")
|
||
public struct ManaSearchButton: View {
|
||
@Environment(\.manaTheme) private var theme
|
||
|
||
private let action: () -> Void
|
||
|
||
/// - Parameter action: Tap-Handler — typischerweise `isPresented = true`,
|
||
/// das den `.searchable`-Modifier öffnet.
|
||
public init(action: @escaping () -> Void) {
|
||
self.action = action
|
||
}
|
||
|
||
public var body: some View {
|
||
Button(action: action) {
|
||
Image(systemName: "magnifyingglass")
|
||
.font(.system(size: 20, weight: .semibold))
|
||
.foregroundStyle(theme.colors.primary)
|
||
.frame(width: 46, height: 46)
|
||
.modifier(SearchButtonBackground(border: theme.colors.border))
|
||
}
|
||
.buttonStyle(.plain)
|
||
.accessibilityLabel("Suchen")
|
||
}
|
||
}
|
||
|
||
/// iOS 26: Liquid-Glass-Kreis. Fallback: Material-Kreis mit Hairline.
|
||
private struct SearchButtonBackground: ViewModifier {
|
||
let border: Color
|
||
|
||
func body(content: Content) -> some View {
|
||
if #available(iOS 26, macOS 26, *) {
|
||
content.glassEffect(.regular.interactive(), in: .circle)
|
||
} else {
|
||
content
|
||
.background(.ultraThinMaterial, in: .circle)
|
||
.overlay(Circle().stroke(border, lineWidth: 0.5))
|
||
}
|
||
}
|
||
}
|