Files
swift-hvac-toolbox/Sources/Styleguide/Buttons.swift

78 lines
1.6 KiB
Swift

import Elementary
public struct PrimaryButton: HTML, Sendable {
let label: String
public init(label: String) {
self.label = label
}
public var content: some HTML<HTMLTag.button> {
button(
.class("""
font-bold py-2 px-4 transition-colors
bg-blue-500 enabled:hover:bg-blue-600
text-yellow-300
""")
) { label }
}
}
public struct SecondaryButton: HTML, Sendable {
let label: String
public init(label: String) {
self.label = label
}
public var content: some HTML<HTMLTag.button> {
button(
.class("""
font-bold py-2 px-4 transition-colors
bg-yellow-300 enabled:hover:bg-yellow-400
text-blue-600
""")
) { label }
}
}
public struct SubmitButton: HTML, Sendable {
let label: String
public init(label: String) {
self.label = label
}
public var content: some HTML<HTMLTag.button> {
button(
.type(.submit),
.class("""
w-full font-bold py-3 rounded-md transition-colors
bg-yellow-300 dark:bg-blue-500
hover:bg-yellow-400 hover:dark:bg-blue-600
text-blue-500 dark:text-yellow-300
""")
) { label }
}
}
public struct ResetButton: HTML, Sendable {
let label: String
public init(label: String = "Reset") {
self.label = label
}
public var content: some HTML<HTMLTag.button> {
button(.class("""
font-bold px-4 py-2 rounded-md transition-colors
bg-blue-500 dark:bg-yellow-300
hover:bg-blue-600 hover:dark:bg-yellow-400
text-yellow-300 dark:text-blue-500
""")) {
label
}
}
}