//
//  StatusBarIndentSelector.swift
//  
//
//  Created by Lukas Pistrol on 22.03.22.
//

import AppPreferences
import SwiftUI
import CodeFile

internal struct StatusBarIndentSelector: View {
    @ObservedObject
    private var model: StatusBarModel

    @StateObject
    private var prefs: AppPreferencesModel = .shared

    internal init(model: StatusBarModel) {
        self.model = model
    }

    internal var body: some View {
        Menu {
            Button {} label: {
                Text("Use Tabs")
            }.disabled(true)

            Button {} label: {
                Text("Use Spaces")
            }.disabled(true)

            Divider()

            Picker("Tab Width", selection: $prefs.preferences.textEditing.defaultTabWidth) {
                ForEach(2..<9) { index in
                    Text("\(index) Spaces")
                        .tag(index)
                }
            }
        } label: {
            StatusBarMenuLabel(text: "\(prefs.preferences.textEditing.defaultTabWidth) Spaces")
                .font(model.toolbarFont)
        }
        .menuIndicator(.hidden)
        .menuStyle(.borderlessButton)
        .fixedSize()
        .onHover { isHovering($0) }
    }
}
