mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-26 09:37:40 +00:00
Some checks are pending
Keyman Build Summary / Summarize build status checks (push) Waiting to run
listen to correct notifications for permission granted standardize file URLs use correct loadFileURl to load help file URL as it it is not loading over HTTP
46 lines
857 B
Swift
46 lines
857 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: String
|
|
|
|
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: String
|
|
let systemImage: String
|
|
let font: Font
|
|
|
|
public var body: some View {
|
|
Button(action: action) {
|
|
Label(label, systemImage: systemImage)
|
|
.font(font)
|
|
}
|
|
.buttonStyle(.bordered)
|
|
}
|
|
}
|