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/Planning/Components/DateUpdateManagerView.swift

54 lines
1.2 KiB

//
// DateUpdateManagerView.swift
// PadelClub
//
// Created by Razmig Sarkissian on 17/04/2024.
//
import SwiftUI
enum DateUpdate {
case nextRotation
case previousRotation
case tomorrowAtNine
case inMinutes(Int)
case afterRound(Round)
case afterGroupStage(GroupStage)
}
struct DateUpdateManagerView: View {
@Binding var startDate: Date
@State private var dateUpdated: Bool = false
var validateAction: () -> Void
var body: some View {
HStack {
Menu {
Text("à demain 9h")
Text("à la prochaine rotation")
Text("à la précédente rotation")
} label: {
Text("décaler")
.underline()
}
Spacer()
if dateUpdated {
Button {
validateAction()
dateUpdated = false
} label: {
Text("valider la modification")
.underline()
}
}
}
.font(.subheadline)
.buttonStyle(.borderless)
.onChange(of: startDate) {
dateUpdated = true
}
}
}