spiegel-keyman/mac/Config/Config/IconButtonView.swift
Shawn Schantz ab30341f59 feat(mac): localization support
added localizable types where necessary
created Localizable.xcstrings for both the
config app and the Keyman settings package
2026-09-02 22:05:53 -04:00

46 lines
881 B
Swift

/*
* Keyman is copyright (C) SIL Global. MIT License.
*
* Created by Gabriel Schantz on 2026-07-03
*
* The view used for image-only buttons
*/
import SwiftUI
public struct IconButtonView: View {
let action: () -> Void
let systemImage: String
let font: Font
let helpText: LocalizedStringKey
public var body: some View {
Button {
action()
} label: {
Image(systemName: systemImage)
.font(font)
}
.buttonStyle(.plain)
.accessibilityLabel(helpText)
.help(helpText)
}
}
// the view for buttons with a label
public struct LabelButtonView: View {
let action: () -> Void
let label: LocalizedStringKey
let systemImage: String
let font: Font
public var body: some View {
Button(action: action) {
Label(label, systemImage: systemImage)
.font(font)
}
.buttonStyle(.bordered)
}
}