//
//  TimePickerSection.swift
//  TheNoiseClock
//
//  Created by Matt Bruce on 9/8/25.
//

import SwiftUI

/// Time picker component for alarm creation with optimized font sizing
struct TimePickerSection: View {
    @Binding var selectedTime: Date
    
    var body: some View {
        GeometryReader { proxy in           
            // Calculate optimal font size for time picker
            let pickerFontSize = 20.0
            
            VStack(spacing: 0) {
                DatePicker(
                    "Time",
                    selection: $selectedTime,
                    displayedComponents: .hourAndMinute
                )
                .datePickerStyle(.wheel)
                .labelsHidden()
                .font(.system(size: pickerFontSize, weight: .medium, design: .rounded))
                .frame(maxWidth: .infinity, maxHeight: .infinity)
                .clipped()
            }
            .background(Color(.systemGroupedBackground))
        }
        .frame(height: 200)
        .onOrientationChange() // Force updates on orientation changes
    }
}
