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) } }