blob: 9162ff01cc22383d65444c9ffc5213484ce52e5a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import SwiftUI
struct PostGridTabButtonView: View {
let title: String
let isSelected: Bool
let onSelect: () -> Void
let onClose: () -> Void
var body: some View {
HStack {
Button(action: onClose) {
Image(systemName: "xmark.square.fill")
.foregroundColor(.secondary)
}
.buttonStyle(PlainButtonStyle())
Text(title)
.lineLimit(1)
}
.padding(.horizontal, 12)
.padding(.vertical, 8)
#if !os(macOS)
.background(isSelected ? Color(.systemGray5) : Color(.systemGray3))
#endif
.opacity(isSelected ? 1 : 0.advanced(by: 0.3))
.clipShape(RoundedRectangle(cornerRadius: 9))
.onTapGesture(perform: onSelect)
.accessibilityAddTraits(.isButton)
}
}
|