Caps-iOS/Caps/Views/SortCaseRowView.swift

34 lines
852 B
Swift
Raw Permalink Normal View History

2022-06-10 21:20:49 +02:00
import SwiftUI
struct SortCaseRowView: View {
@Binding
var selectedType: SortCriteria
let type: SortCriteria
var body: some View {
Button(action: { selectedType = type}) {
HStack {
Text(type.text)
.foregroundColor(.primary)
Spacer()
if selectedType == type {
Image(systemSymbol: .checkmark)
}
}
.padding(.horizontal)
.padding(.vertical, 8)
.background(Color(UIColor.systemGroupedBackground))
.cornerRadius(8)
}
}
}
struct SortCaseRowView_Previews: PreviewProvider {
static var previews: some View {
SortCaseRowView(selectedType: .constant(.id), type: .id)
.previewLayout(.fixed(width: 375, height: 50))
}
}