//
//  SettingsView.swift
//  DouShouQi_App
//
//  Created by etudiant on 27/05/2024.
//

import SwiftUI

extension String : Identifiable {
    public var id: Self { return self }
}

struct SettingsView: View {
    
    @State private var theme = false
    @State private var choice = "English"
    @State private var sound = true
    
    var body: some View {
        VStack {
            TitlePageFrame(Text: "Settings")
            
            VStack {
                Divider()
                
                HStack {
                    Text("Theme")
                        .font(.headline)
                    
                    Spacer()
                    
                    CustomSwitchButton(IsOn: $theme, imgSystemNameIsOff: SystemIcons.LightTheme, imgSystemNameIsOn: SystemIcons.DarkTheme)
                }
                
                Divider()
                
                HStack {
                    Text("Language")
                        .font(.headline)
                    
                    Spacer()
                    
                    Picker("Sort", selection: $choice) {
                        ForEach(["English", "Français", "Español"]) {
                            Text($0)
                        }
                    }
                    .pickerStyle(.menu)
                }
                
                Divider()
                
                HStack {
                    Text("Theme")
                        .font(.headline)
                    
                    Spacer()
                    
                    CustomSwitchButton(IsOn: $sound, imgSystemNameIsOff: SystemIcons.SoundOff, imgSystemNameIsOn: SystemIcons.SoundOn)
                }
                
                Divider()
            }
            .padding(20)
            
            Spacer()
        }
    }
}

struct SettingsView_Previews: PreviewProvider {
    static var previews: some View {
        SettingsView()
    }
}
