|
|
|
@ -4,6 +4,8 @@ struct SearchBarView: View { |
|
|
|
@State private var searchText = "" |
|
|
|
@State private var searchText = "" |
|
|
|
let trackCount: Int |
|
|
|
let trackCount: Int |
|
|
|
let onSearch: (String) -> Void |
|
|
|
let onSearch: (String) -> Void |
|
|
|
|
|
|
|
let isShazamListening: Bool |
|
|
|
|
|
|
|
let onShazam: () -> Void |
|
|
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
var body: some View { |
|
|
|
HStack(spacing: 12) { |
|
|
|
HStack(spacing: 12) { |
|
|
|
@ -33,6 +35,15 @@ struct SearchBarView: View { |
|
|
|
Text("\(trackCount) tracks") |
|
|
|
Text("\(trackCount) tracks") |
|
|
|
.font(.caption) |
|
|
|
.font(.caption) |
|
|
|
.foregroundStyle(.secondary) |
|
|
|
.foregroundStyle(.secondary) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: onShazam) { |
|
|
|
|
|
|
|
Image(systemName: "shazam.logo") |
|
|
|
|
|
|
|
.font(.system(size: 16)) |
|
|
|
|
|
|
|
.foregroundStyle(isShazamListening ? .blue : .secondary) |
|
|
|
|
|
|
|
.symbolEffect(.pulse, isActive: isShazamListening) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.buttonStyle(.plain) |
|
|
|
|
|
|
|
.help(isShazamListening ? "Stop listening" : "Identify song with Shazam") |
|
|
|
} |
|
|
|
} |
|
|
|
.padding(.horizontal, 16) |
|
|
|
.padding(.horizontal, 16) |
|
|
|
.padding(.vertical, 8) |
|
|
|
.padding(.vertical, 8) |
|
|
|
|