42 lines
996 B
Swift
42 lines
996 B
Swift
import Elementary
|
|
|
|
/// An action the prototype shows but does not build: a button that is visibly, and audibly, unavailable.
|
|
struct Unavailable: HTML {
|
|
|
|
// MARK: Properties
|
|
|
|
/// The action's name.
|
|
let label: String
|
|
|
|
/// A modifier class sizing or styling the button, or `nil` for none.
|
|
let modifier: String?
|
|
|
|
// MARK: Initializers
|
|
|
|
/// Creates an unavailable action.
|
|
/// - Parameters:
|
|
/// - label: the action's name.
|
|
/// - modifier: a modifier class sizing or styling the button, or `nil` (the default) for none.
|
|
init(
|
|
_ label: String,
|
|
modifier: String? = nil
|
|
) {
|
|
self.label = label
|
|
self.modifier = modifier
|
|
}
|
|
|
|
// MARK: Computed
|
|
|
|
var body: some HTML {
|
|
button(
|
|
.class(["button", modifier].compactMap(\.self).joined(separator: " ")),
|
|
.type(.button),
|
|
.disabled,
|
|
.title("Not part of the prototype")
|
|
) {
|
|
label
|
|
}
|
|
}
|
|
|
|
}
|