You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
PadelClub/PadelClub/Views/Navigation/Organizer/TournamentButtonView.swift

39 lines
1.2 KiB

//
// TournamentButtonView.swift
// PadelClub
//
// Created by Razmig Sarkissian on 03/03/2024.
//
import SwiftUI
struct TournamentButtonView: View {
@Environment(\.colorScheme) var colorScheme
@Environment(NavigationViewModel.self) private var navigation
let tournament: Tournament
var body: some View {
Button {
if navigation.isTournamentAlreadyOpenInOrganizer(tournament) {
navigation.closeTournamentFromOrganizer(tournament)
} else {
navigation.openTournamentInOrganizer(tournament)
}
} label: {
TournamentCellView(tournament: tournament, displayStyle: .short)
.padding(8)
.overlay(
RoundedRectangle(cornerRadius: 20)
.stroke(colorScheme == .light ? Color.black : Color.white, lineWidth: 2)
)
.fixedSize(horizontal: false, vertical: true)
}
.overlay(alignment: .top) {
if navigation.isTournamentAlreadyOpenInOrganizer(tournament) {
Image(systemName: "ellipsis")
.offset(y: -10)
}
}
}
}